Repository navigation
`
server {
listen 80;
server_name my-site.ru *.my-site.ru;
access_log on;
access_log /var/log/nginx/my-site.ru.access.log;
error_log /var/log/nginx/my-site.ru.error.log;
root /var/www/local-website/my-site.ru;
index index.php index.html index.htm;
charset UTF-8;
fastcgi_param Host $host;
fastcgi_param X-Real-IP $remote_addr;
fastcgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
#if ($host != $server_name) {
# rewrite ^/(.*) $scheme://$server_name/1ドル permanent;
#}
# www or without www
if ($host = 'www.my-site.ru' ) {
rewrite ^(.*)$ http://my-site.ru1ドル permanent;
}
# Remove excess slash
if ($request_uri ~* "\/\/") {
rewrite ^/(.*) $scheme://$server_name/1ドル permanent;
}
location @rewrite {
rewrite ^/(.*)$ /index.php?q=1ドル last;
#php
if (-e $request_filename.php) {
rewrite ^ $uri.php last;
}
#html
if (-e $request_filename.html) {
rewrite ^ $uri.html last;
}
if (-f $request_filename) {
expires 30d;
break;
}
}
location / {
autoindex off;
autoindex_exact_size off;
try_files $uri $uri/ @rewrite;
}
location ~ .php$ {
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_send_timeout 180s;
fastcgi_read_timeout 180s;
try_files $uri @rewrite;
}
location ~ /.ht {
deny all;
}
}
`
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment