fast alternative to Apache httpd2 and mod_php5 |
/etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
events {
worker_connections 1024;
use epoll;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
include conf.d/*.conf;
server {
listen 80;
server_name localhost;
location ~* ^/~(.+?)(/.*\.php)$
{
alias /home/$1/public_html$2;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
location ~ ^/~(.+?)(/.*)?$ {
alias /home/$1/public_html$2;
index index.html index.htm index.php;
autoindex on;
}
location / {
root /srv/www/htdocs/;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /srv/www/htdocs/;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/htdocs/$fastcgi_script_name;
include fastcgi_params;
}
}
include vhosts.d/*.conf;
}
Don't forget to start it:
systemctl start nginx
systemctl start php-fpm