tech-tips/Языки программирования/PHP/Modx/Образец конфига nginx для сайта на базе modx evolution.md

63 lines
1.3 KiB
Markdown
Raw Permalink Normal View History

```
server {
listen 80;
server_name modxevo.loc;
server_name_in_redirect off;
# access_log /var/log/nginx/modxevo.loc.access.log;
# error_log /var/log/nginx/modxevo.loc.error.log error;
index index.htm index.html index.php;
autoindex on;
client_max_body_size 1024M;
client_body_buffer_size 4M;
root /var/www/modxevo.loc/public;
location / {
\#allow 127.0.0.1;
\#deny all;
try_files $uri $uri/ @modx;
}
location @modx {
rewrite ^/(.*)$ /index.php?q=$1&$args;
}
location ~ \\.php(.*)$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; #путь до сокета php-fpm
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* ^.+\\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar)$ {
access_log off;
expires max;
error_page 404 = /404.html;#не забываем создать страницу
}
#все помнят это :)
location ~ /.svn/ {
deny all;
}
location ~ /\\.ht {
deny all;
}
}
server {
server_name www.modxevo.loc;
return 301 $scheme://modxevo.loc$request_uri;
}
```