Created
March 8, 2021 02:33
-
-
Save fahmiegerton/4de2c794359d7065990b5c0838f05b15 to your computer and use it in GitHub Desktop.
Nuxt and PHP app under one domain [Nuxt => example.test, PHP =>example.test/api]. But it's not working, help!!
This file contains hidden or 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 { | |
## How to allow access from LAN and Internet to your local project: | |
## https://winnmp.wtriple.com/howtos#How-to-allow-access-from-LAN-and-Internet-to-your-local-project | |
listen 127.0.0.1:80; | |
## Enable self signed SSL certificate: | |
## https://winnmp.wtriple.com/howtos#Enable-self-signed-SSL-certificate-for-your-local-project | |
listen 127.0.0.1:443 ssl http2; | |
ssl_certificate_key "d:/winnmp/conf/opensslCA/selfsigned/example.test.key"; | |
ssl_certificate "d:/winnmp/conf/opensslCA/selfsigned/example.test.crt"; | |
## How to add additional local test server names to my project: | |
## https://winnmp.wtriple.com/howtos#How-to-add-additional-local-test-server-names-to-my-project | |
server_name example.test; | |
## To manually change the root directive replace the ending comment with: # locked | |
## https://winnmp.wtriple.com/howtos#How-to-change-the-root-directory-of-a-project | |
root "D:/winnmp/www/example/server/public"; # locked | |
add_header X-Frame-Options "SAMEORIGIN"; | |
add_header X-XSS-Protection "1; mode=block"; | |
add_header X-Content-Type-Options "nosniff"; | |
## Access Restrictions | |
allow 127.0.0.1; | |
deny all; | |
## Add locations: | |
## https://winnmp.wtriple.com/howtos#How-to-add-locations | |
## Configure for various PHP Frameworks: | |
## http://winnmp.wtriple.com/nginx.php | |
autoindex on; | |
location / { | |
proxy_redirect off; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_read_timeout 1m; | |
proxy_connect_timeout 1m; | |
# Websocket support | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
# Proxy to the Node.JS instance of the client app | |
proxy_pass http://localhost:3000; | |
} | |
location ~ ^/api/.*\.php$ { | |
root "D:/winnmp/sites/example/server/public"; | |
try_files $uri =404; | |
include nginx.fastcgi.conf; | |
include nginx.redis.conf; | |
fastcgi_pass php_farm; | |
fastcgi_hide_header X-Powered-By; | |
} | |
location /api { | |
root "D:/winnmp/sites/example/server/public"; | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location ~ /\.(?!well-known).* { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment