MyTetra Share
Делитесь знаниями!
Nginx - настройка сайта для приложения на Yii2
Время создания: 13.07.2018 15:31
Автор: veksoftware
Текстовые метки: nginx yii2
Раздел: Nginx
Запись: Velonski/mytetra-database/master/base/1481821091ve23uw2s7u/text.html на raw.githubusercontent.com

# nginx configuration

server {

listen 80;

server_name *.simsuper.ru simsuper.ru supersim24.ru, www.supersim24.com;

location / {

rewrite ^/(.*)$ http://supersim24.com/$1 redirect;

}

}


server {

listen 80;

# listen 443 ssl;

server_name "~(^(?<version>[vt]\d{4})\.supersim24\.com$|^supersim24\.com$)";

server_tokens off;


if ( $host != "supersim24.com" ) {

set $dev "-dev";

}


client_max_body_size 128M;

charset utf-8;


if ( $version = false ) {

set $version "";

}


if ( $version = "" ) {

set $host_path "/var/www/supersim24";

}


if ( -d "/var/www/supersim24_$version") {

set $host_path "/var/www/supersim24_${version}";

}


if ( $host_path = false ) {

return 410 "Removed";

}


# ssl_certificate /etc/nginx/ssl/supersim.top.crt;

# ssl_certificate_key /etc/nginx/ssl/supersim.top.key;


set $yii_bootstrap "index.php";

set $log_path "";


access_log /var/log/nginx/supersim/access.log;

error_log /var/log/nginx/supersim/error.log;


root "${host_path}/web";

index $yii_bootstrap;


location ~ ^/redmine(/.*|$) {

alias /var/www/redmine/public$1;

passenger_enabled on;

passenger_friendly_error_pages on;

passenger_base_uri /redmine;

passenger_app_root /var/www/redmine;

passenger_document_root /var/www/redmine/public;

client_max_body_size 10m; # Max attachemnt size

}


location / {

try_files $uri $uri/ /$yii_bootstrap?$args;

}


location ~ \.php$ {

try_files $uri =404;


fastcgi_split_path_info ^(.+\.php)(/.+)$;

fastcgi_index $yii_bootstrap;


# Connect to php-fpm via socket

fastcgi_pass unix:/run/php/php7.0-fpm.sock;


fastcgi_connect_timeout 5m; # 30s

fastcgi_read_timeout 5m; # 30s

fastcgi_send_timeout 5m; # 60s

fastcgi_ignore_client_abort on;

fastcgi_pass_header "X-Accel-Expires";


fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param PATH_INFO $fastcgi_path_info;

fastcgi_param HTTP_REFERER $http_referer;

include fastcgi_params;

fastcgi_param SERVER_NAME $host;

# fastcgi_param HTTPS on;

}


location ~* \.(js|css|less|png|jpg|jpeg|gif|ico|woff|ttf|svg|tpl)$ {

expires 24h;

access_log off;

}


location = /favicon.ico {

log_not_found off;

access_log off;

}


location = /robots.txt {

alias "${host_path}/robots${dev}.txt";

log_not_found off;

access_log off;

}


location ~ /\. {

deny all;

access_log off;

log_not_found off;

}

}

Так же в этом разделе:
 
MyTetra Share v.0.65
Яндекс индекс цитирования