Самый простой конфиг Nginx + FastCGI + https

27th Ноябрь 2013 ;)

В сети много всяких примеров, но тут всё как-то совсем просто и понятно.

server {
    server_name sitename.com;

    listen 80;

    listen 443 ssl;
    ssl_certificate /etc/nginx/sitename.com.crt;
    ssl_certificate_key /etc/nginx/sitename.com.key;
    ssl_session_timeout 5m; 

    root /var/www/sitename.com/public;
    index index.html index.htm index.php;
    autoindex off;  

    try_files $uri $uri/ /index.php?$query_string;

    access_log /var/log/nginx/sitename.com.access.log;
    error_log /var/log/nginx/sitename.com.error.log;

    location ~* .php$ {
        fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/www/sitename.com/public$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
    }
}

Сегодня: 2016.12.10
jAntivirus