Last active
May 31, 2019 06:18
-
-
Save olegpolukhin/0f9d0e0262516fbdfc2ad031d53d629f to your computer and use it in GitHub Desktop.
NGINX conf. Angular 7 + PHP (frontend + backend)
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 frontend { | |
server 127.0.0.1:8085; | |
} | |
upstream backend { | |
server 127.0.0.1:8086; | |
} | |
server { | |
listen 82; | |
server_name project.loc; | |
location / { | |
proxy_pass http://frontend; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Real-PORT $remote_port; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
location /api { | |
proxy_pass http://backend; | |
proxy_set_header Host $host; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
add_header Access-Control-Allow-Origin *; | |
add_header Access-Control-Allow-Headers 'Origin, X-Requested-With, Content-Type, Accept, Authorization'; | |
} | |
} | |
server { | |
listen 8085; | |
server_name _; | |
root /var/www/hs-stats-front/dist; | |
location / { | |
index index.html | |
try_files $uri $uri/ /index.html; | |
} | |
location ~* \.(gif|jpg|jpeg|png|bmp|wmv|avi|mpg|mpeg|mp4|htm|html|deb|bz2|swf|pdf|ico|txt|woff|woff2)$ { | |
expires max; | |
} | |
} | |
server { | |
listen 8086; | |
server_name _; | |
root /var/www/hs-stats-back; | |
location / { | |
try_files $uri $uri/ /index.php$request_uri; | |
} | |
location ~ \.php { | |
include snippets/fastcgi-php.conf; | |
#fastcgi_index index.php; | |
fastcgi_pass unix:/run/php/php7.0-fpm.sock; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment