Created
April 19, 2017 04:20
-
-
Save kiennt2/746b249a4242e0ec53b381941b27de8a to your computer and use it in GitHub Desktop.
Magento 2 - nginx conf
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
# cd /etc/nginx/ | |
# sudo mkdir ssl | |
# sudo openssl req -x509 -sha256 -newkey rsa:2048 -keyout cert.key -out cert.pem -days 1024 -nodes -subj '/CN=www.domain.local' | |
upstream fastcgi_backend { | |
# use tcp connection | |
# server 127.0.0.1:9000; | |
# or socket | |
server unix:/run/php/php7.0-fpm.sock; | |
} | |
server { | |
listen 80; | |
server_name www.courts.local courts.local; | |
set $MAGE_ROOT /home/kiennguyen/projects/courts; | |
set $MAGE_MODE developer; | |
include /home/kiennguyen/projects/courts/nginx.conf; | |
index index.php index.html index.htm; | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
include fastcgi_params; | |
fastcgi_pass unix:/run/php/php7.0-fpm.sock; | |
fastcgi_read_timeout 3000; | |
fastcgi_param SCRIPT_FILENAME /home/kiennguyen/projects/courts$fastcgi_script_name; | |
fastcgi_param MAGE_MODE $MAGE_MODE; | |
} | |
} | |
server { | |
listen 443 ssl http2; | |
server_name www.courts.local courts.local; | |
ssl_certificate /etc/nginx/ssl/cert.pem; | |
ssl_certificate_key /etc/nginx/ssl/cert.key; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers 'AES128+EECDH:AES128+EDH:!aNULL'; | |
ssl_session_cache shared:SSL:10m; | |
ssl_session_timeout 24h; | |
keepalive_timeout 300s; | |
location / { | |
proxy_pass http://127.0.0.1; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Forwarded-Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Ssl-Offloaded "1"; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_set_header X-Forwarded-Port 443; | |
#proxy_hide_header X-Varnish; | |
#proxy_hide_header Via; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
} | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
include fastcgi_params; | |
fastcgi_pass unix:/run/php/php7.0-fpm.sock; | |
fastcgi_read_timeout 3000; | |
fastcgi_param SCRIPT_FILENAME /home/kiennguyen/projects/courts$fastcgi_script_name; | |
fastcgi_param MAGE_MODE $MAGE_MODE; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment