Arch Linux Web Servers - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Arch Linux Web Servers Guide
Complete beginner-friendly guide to web servers on Arch Linux, including Apache, Nginx, and web server configuration.
Table of Contents
Apache
Install Apache
Install Apache:
# Install Apache
sudo pacman -S apache
# Enable service
sudo systemctl enable httpd
sudo systemctl start httpd
# Check status
systemctl status httpd
Apache Configuration
Configure Apache:
# Edit config
sudo vim /etc/httpd/conf/httpd.conf
# Edit virtual hosts
sudo vim /etc/httpd/conf/extra/httpd-vhosts.conf
Test Apache
Test server:
# Check if running
curl http://localhost
# Or open browser
# http://localhost
Nginx
Install Nginx
Install Nginx:
# Install Nginx
sudo pacman -S nginx
# Enable service
sudo systemctl enable nginx
sudo systemctl start nginx
# Check status
systemctl status nginx
Nginx Configuration
Configure Nginx:
# Edit config
sudo vim /etc/nginx/nginx.conf
# Edit site config
sudo vim /etc/nginx/sites-available/example
Test Nginx
Test server:
# Check if running
curl http://localhost
# Or open browser
# http://localhost
Web Server Configuration
Virtual Hosts
Apache virtual host:
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/example
</VirtualHost>
Nginx server block:
server {
listen 80;
server_name example.com;
root /var/www/example;
}
SSL/TLS
Install certificates:
# Install certbot
sudo pacman -S certbot certbot-apache certbot-nginx
# Get certificate
sudo certbot --apache
sudo certbot --nginx
Troubleshooting
Server Not Starting
Check logs:
# Apache logs
sudo journalctl -u httpd
# Nginx logs
sudo journalctl -u nginx
# Check config
sudo apachectl configtest
sudo nginx -t
Port Conflicts
Check ports:
# Check listening ports
ss -tlnp | grep :80
ss -tlnp | grep :443
Summary
This guide covered Apache, Nginx, web server configuration, and troubleshooting.
Next Steps
- Arch Linux Networking - Network setup
- Arch Linux Security Configuration - Security
- ArchWiki Web Servers: https://wiki.archlinux.org/title/List_of_applications/Internet#Web_servers
This guide is based on the ArchWiki. For the most up-to-date information, always refer to the official ArchWiki.