I use Nginx as a server, and I currently use this for configuration of each my sites. Basically, I have multiple files like this located in /etc/nginx/conf.d/
.
#example.conf
server {
listen 80;
server_name www.my-site.com my-site.com;
root /var/www/html/my-site.com;
location / {
rewrite ^/category/(.*)$ /category.php?id=$1 last;
rewrite ^/profile/(.*)$ /profile.php?id=$1 last;
try_files $uri $uri/ /index.php?$query_string;
}
index index.html index.htm index.php;
error_page 404 /404.html;
location = /var/www/html/nginx/error/404.html {
root /var/www/html/nginx/error/;
}
error_page 500 502 503 504 /50x.html;
location = /var/www/html/nginx/error/50x.html {
root /var/www/html/nginx/error/error/;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
So, I have 6 sites with their own file like this, and since I am about to do a complete re-install of my server, I would like to know how I can improve this configuration, both security and optimization wise.