Last active
August 6, 2019 12:52
-
-
Save XNicON/0e3ee485c69559863a8c611416c0819d to your computer and use it in GitHub Desktop.
Frontend, Backend and Admin. Symfony and Yii2 in subdirectory
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 { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
set $root_path /var/www; | |
root $root_path; | |
server_name domain.com; | |
error_log /var/log/nginx/domain.com-errors.log; | |
access_log /var/log/nginx/domain.com-access.log; | |
location / { | |
root $root_path/frontend/dist; | |
try_files $uri /index.html /frontend/dist/index.php$is_args$args; | |
} | |
location /api { | |
root $root_path/backend/web; | |
rewrite ^/api/(.*)$ /$1 break; | |
try_files $uri @backend; | |
} | |
location /admin { | |
root $root_path/admin/web; | |
rewrite ^/admin/(.*)$ /$1 break; | |
try_files $uri @admin; | |
} | |
location @admin { | |
fastcgi_pass unix:/run/php/php7.3-fpm.sock; | |
include snippets/fastcgi-php.conf; | |
fastcgi_param SCRIPT_FILENAME $root_path/admin/web/index.php; | |
fastcgi_param SCRIPT_NAME /admin/index.php; | |
fastcgi_param REQUEST_URI /admin$uri?$args; | |
} | |
location @backend { | |
fastcgi_pass unix:/run/php/php7.3-fpm.sock; | |
include snippets/fastcgi-php.conf; | |
fastcgi_param SCRIPT_FILENAME $root_path/backend/web/index.php; | |
fastcgi_param SCRIPT_NAME /api/index.php; | |
fastcgi_param REQUEST_URI /api$uri?$args; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment