Last active
September 13, 2018 22:17
-
-
Save MaximStrutinskiy/0009243c216f76ff1588df1ec5ad597f to your computer and use it in GitHub Desktop.
Nginx config with reverse proxy + ssl(https)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 ; | |
listen [::]:80; | |
server_name newstore.com.ua www.newstore.com.ua; | |
return 301 https://www.$server_name$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
listen [::]:443; | |
server_name newstore.com.ua; | |
ssl_certificate /var/www/newstore/ssl/newstore.crt; | |
ssl_certificate_key /var/www/newstore/ssl/newstore.key; | |
return 301 https://www.newstore.com.ua$request_uri; | |
} | |
server { | |
listen 443 ssl http2 default_server; | |
listen [::]:443 ssl http2 default_server; | |
server_name www.newstore; | |
root /var/www/newstore/web; | |
error_log /var/www/newstore-log/error.log; | |
access_log /var/www/newstore-log/access.log; | |
ssl_certificate /var/www/newstore/ssl/newstore.crt; | |
ssl_certificate_key /var/www/newstore/ssl/newstore.key; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_prefer_server_ciphers on; | |
ssl_dhparam //etc/ssl/private/dhparam2048.pem; | |
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA'; | |
ssl_session_timeout 1d; | |
ssl_session_cache shared:SSL:50m; | |
ssl_stapling on; | |
ssl_stapling_verify on; | |
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload'; | |
index app.php; | |
try_files $uri @rewrite; | |
gzip on; | |
gzip_comp_level 6; | |
gzip_min_length 10240; | |
gzip_proxied expired no-cache no-store private auth; | |
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml; | |
gzip_disable "msie6"; | |
location @rewrite { | |
rewrite ^/?(.*)$ /app.php/$1 last; | |
} | |
location ~ ^/(app|app_dev)\.php { | |
fastcgi_index $1.php; | |
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location ~* \.(css|txt|xml|js|gif|jpe?g|png|ico|eot|ttf|woff|woff2)$ { | |
expires 1y; | |
log_not_found off; | |
} | |
location ~* \.(eot|ttf|woff|woff2)$ { | |
add_header Access-Control-Allow-Origin *; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment