2014-12-27 10:09:00 +01:00
|
|
|
server {
|
2023-02-21 18:08:54 +01:00
|
|
|
# default_server from default vhost must exist somewhere!
|
2023-05-18 10:33:33 +02:00
|
|
|
listen 80;
|
|
|
|
listen [::]:80;
|
|
|
|
listen 443;
|
|
|
|
listen [::]:443;
|
2023-02-21 18:08:54 +01:00
|
|
|
# Enable this if your want HSTS (recommended)
|
2023-05-18 10:33:33 +02:00
|
|
|
add_header Strict-Transport-Security
|
2023-10-19 08:27:55 +02:00
|
|
|
"max-age=15552000; includeSubdomains; preload";
|
2023-05-18 10:33:33 +02:00
|
|
|
add_header X-Frame-Options SAMEORIGIN;
|
|
|
|
add_header Content-Security-Policy upgrade-insecure-requests;
|
|
|
|
add_header X-Xss-Protection "1; mode=block" always;
|
|
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
|
|
root /var/www/vhostdir;
|
|
|
|
index index.php index.html index.htm;
|
2023-02-21 18:08:54 +01:00
|
|
|
# vhost address
|
|
|
|
server_name vhost.example.org;
|
2014-12-27 10:09:00 +01:00
|
|
|
|
2023-02-21 18:08:54 +01:00
|
|
|
location / {
|
|
|
|
# First attempt to serve request as file, then
|
|
|
|
# as directory, then fall back to displaying a 404.
|
|
|
|
try_files $uri $uri/ =404;
|
|
|
|
autoindex off;
|
|
|
|
}
|
2014-12-27 10:09:00 +01:00
|
|
|
|
2023-02-21 18:08:54 +01:00
|
|
|
# Userdir
|
|
|
|
#ilocation ~ ^/~(.+?)(/.*)?$ {
|
|
|
|
# alias /home/$1/public_html$2;
|
|
|
|
# index index.html index.htm;
|
|
|
|
# autoindex on;
|
|
|
|
#}
|
|
|
|
#error_page 404 /404.html;
|
|
|
|
# redirect server error pages to the static page /50x.html
|
|
|
|
#
|
|
|
|
#error_page 500 502 503 504 /50x.html;
|
|
|
|
#location = /50x.html {
|
|
|
|
# root /usr/share/nginx/html;
|
|
|
|
#}
|
|
|
|
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
|
|
|
#
|
|
|
|
location ~ \.php$ {
|
|
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
2023-05-18 10:33:33 +02:00
|
|
|
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
|
|
|
|
#
|
|
|
|
# # With php5-cgi alone:
|
|
|
|
# fastcgi_pass 127.0.0.1:9000;
|
|
|
|
# # With php5-fpm:
|
|
|
|
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
|
|
|
fastcgi_index index.php;
|
2023-02-21 18:08:54 +01:00
|
|
|
#include fastcgi_params;
|
2023-05-18 10:33:33 +02:00
|
|
|
include fastcgi.conf;
|
2023-02-21 18:08:54 +01:00
|
|
|
}
|
2014-12-27 10:09:00 +01:00
|
|
|
|
2023-02-21 18:08:54 +01:00
|
|
|
# deny access to .htaccess files, if Apache's document root
|
|
|
|
# concurs with nginx's one
|
|
|
|
#
|
|
|
|
location ~ /\.ht {
|
|
|
|
deny all;
|
|
|
|
}
|
2023-10-19 08:27:55 +02:00
|
|
|
}
|