Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- server_name site.ru;
- charset off;
- access_log /var/www/site.ru/logs/access.log;
- error_log /var/www/site.ru/logs/error.log;
- root /var/www/site.ru/public;
- index index.php index.html;
- # serve static files directly
- location ~* \.(jpg|jpeg|gif|css|png|js|ico|html|txt)$ {
- access_log off;
- expires max;
- log_not_found off;
- }
- # removes trailing slashes (prevents SEO duplicate content issues)
- if (!-d $request_filename)
- {
- rewrite ^/(.+)/$ /$1 permanent;
- }
- # enforce NO www
- if ($host ~* ^www\.(.*))
- {
- set $host_without_www $1;
- rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
- }
- location / {
- set $root "/var/www/site.ru/public";
- try_files $uri $uri/ /index.php?$query_string;
- # unless the request is for a valid file (image, js, css, etc.), send to bootstrap
- if (!-e $request_filename)
- {
- rewrite ^/(.*)$ /index.php?/$1 last;
- break;
- }
- }
- location /i {
- set $root "/var/www/test";
- root $root;
- try_files $uri $uri/ /index.php?$query_string;
- # unless the request is for a valid file (image, js, css, etc.), send to bootstrap
- if (!-e $request_filename)
- {
- rewrite ^/(.*)$ /index.php?/$1 last;
- break;
- }
- }
- location ~* \.php$ {
- root $root;
- try_files $uri = 404;
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; # may also be: 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- location ~ /\.ht {
- deny all;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement