Nginx + PHP FPM + Webpack + Laravel
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
upstream fpm_sock { | |
server unix:/var/run/php7.2.9-fpm.sock; | |
} | |
server { | |
listen 80; | |
access_log /var/log/nginx/access.log; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
server_name example.localhost; | |
root /var/www/example.localhost/public; | |
index index.php; | |
ssl_certificate /etc/ssl/private/example.localhost.crt.pem; | |
ssl_certificate_key /etc/ssl/private/example.localhost.key.pem; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers HIGH:!aNULL:!MD5; | |
ssl_prefer_server_ciphers on; | |
add_header X-Frame-Options "SAMEORIGIN"; | |
add_header X-XSS-Protection "1; mode=block"; | |
add_header X-Content-Type-Options "nosniff"; | |
charset utf-8; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
############################################################################ | |
# Webpack dev server websocket | |
############################################################################ | |
location /sockjs-node { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $remote_addr; | |
proxy_set_header Host $host; | |
proxy_pass https://10.0.0.10:5000; | |
proxy_redirect off; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
############################################################################ | |
# PHP FPM | |
############################################################################ | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
#fastcgi_pass 11.0.0.5:9000; | |
fastcgi_pass fpm_sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment