Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # You may add here your
- # server {
- # ...
- # }
- # statements for each of your virtual hosts
- server {
- listen 80; ## listen for ipv4
- # listen [::]:80 default ipv6only=on; ## listen for ipv6
- server_name forum.maybe.ru www.forum.maybe.ru;
- set $main_host 'forum.maybe.ru';
- #Делаем, чтобы сайт не открывался по IP
- if ($http_host ~ "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}") {
- return 444;
- }
- if ($host != $main_host) {
- rewrite ^(.*)$ http://$main_host$1 permanent;
- break;
- }
- access_log /var/log/nginx/localhost.access.log;
- error_log /var/log/nginx/forum.maybe.ru.error.log;
- root /var/www/$main_host/www;
- index index.php index.html index.htm;
- ## Disable viewing .htaccess & .htpassword
- location ~ /\.ht {
- deny all;
- }
- if ($http_user_agent ~* "WordPress") {
- return 444;
- }
- location / {
- index index.php index.html index.htm;
- try_files $uri $uri/ /index.php?q=$uri&$args;
- }
- location ~ \.php$ {
- include /etc/nginx/conf/fastcgi_params.conf;
- fastcgi_param SCRIPT_FILENAME /var/www/$main_host/www$fastcgi_script_name;
- fastcgi_param DOCUMENT_ROOT /var/www/$main_host/www;
- fastcgi_param PHP_ADMIN_VALUE upload_tmp_dir=/var/www/$main_host/tmp/upload;
- fastcgi_param PHP_ADMIN_VALUE session.save_path=/var/www/$main_host/tmp/sessions;
- }
- location = /favicon.ico {
- try_files /favicon.ico @favicon_empty;
- expires 7d;
- access_log off;
- log_not_found off;
- }
- location @favicon_empty {
- empty_gif;
- expires 7d;
- access_log off;
- log_not_found off;
- }
- location ~* ^.+\.(ico|htm|html|txt|jpg|png|gif|css|js)$ {
- access_log off;
- autoindex off;
- expires 30d;
- add_header Cache-Control 'public';
- }
- location = /robots.txt {
- allow all;
- log_not_found off;
- access_log off;
- }
- location ~ /\. {
- deny all;
- access_log off;
- log_not_found off;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement