this repo has no description
1# Apache Web Service 2 3## Service Name 4- `apache2` (Ubuntu/Debian) 5- `httpd` (CentOS/RHEL) 6 7## Check Service Status 8```bash 9systemctl status apache2 # Ubuntu 10systemctl status httpd # CentOS 11``` 12 13## Configuration Locations 14 15Main config: `/etc/apache2/` (Ubuntu) or `/etc/httpd/` (CentOS) 16 17Key files: 18- `/etc/apache2/apache2.conf` - Main configuration 19- `/etc/apache2/sites-available/` - Available site configs 20- `/etc/apache2/sites-enabled/` - Active site configs (usually symlinks) 21 22## Default Site Configuration 23 24File: `/etc/apache2/sites-available/000-default.conf` 25 26Key directives: 27```apache 28<VirtualHost *:80> 29 DocumentRoot /var/www/html 30 # ... other settings 31</VirtualHost> 32``` 33 34- **Listen port**: Default is `*:80` (any IP, port 80) 35- **DocumentRoot**: `/var/www/html` - where website files live 36 37## Website File Location 38 39Website files go in: `/var/www/html` 40 41Default file: `index.html` (or `index.php`) 42 43The web server automatically serves `index.html` when you visit the root URL. 44 45## Start/Restart Service 46 47```bash 48sudo systemctl start apache2 49sudo systemctl restart apache2 50``` 51 52## Creating Website Content 53 54Make directories: 55```bash 56sudo mkdir /var/www/html/newfolder 57``` 58 59Create files: 60```bash 61sudo touch /var/www/html/newfile.html 62``` 63 64**Permission Requirements**: Web server needs read permissions to serve files. 65 66## Security Considerations 67 68- Don't put sensitive files (like `/etc/shadow`) in `/var/www/html` 69- Check permissions - files need to be readable by web server 70- Backup config files before making changes 71- The website displays actual files from the server's filesystem 72 73## Common Issues 74 751. **Service not starting**: Check config file syntax 762. **Can't access website**: Verify service is running, check IP/port 773. **404 errors**: Check DocumentRoot path and file permissions 784. **Permission denied**: Files need world-readable permissions for web server access