-
Notifications
You must be signed in to change notification settings - Fork 3
Nginx
d47081 edited this page Dec 1, 2023
·
8 revisions
Follow official Symfony docs
https://symfony.com/doc/current/setup/web_server_configuration.html
URL example:
http://tracker.ygg
App sources:
/var/www/YGGverse/YGGtracker
Web root:
/var/www/html
Symlink:
ln -s /var/www/YGGverse/YGGtracker/public /var/www/html/yggtracker
Config:
server {
listen [::]:80;
# Yggdrasil-only connections
# allow 0200::/7;
# deny all;
root /var/www/YGGverse/YGGtracker/public;
index index.html index.htm index.nginx-debian.html index.php;
server_name tracker.ygg;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/index\.php(/|$) {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Environment variables
# bin/console cache:clear
fastcgi_param APP_ENV prod;
internal;
}
location ~ \.php$ {
return 404;
}
}
URL example:
http://[0200::/7]/yggtracker
App sources:
/var/www/YGGverse/YGGtracker
Web root:
/var/www/html
Symlink:
ln -s /var/www/YGGverse/YGGtracker/public /var/www/html/yggtracker
Config:
# /etc/nginx/sites-available/default
server {
listen [::]:80 default;
# Yggdrasil-only connections
# allow 0200::/7;
# deny all;
root /var/www/html;
index index.html index.htm index.nginx-debian.html index.php;
server_name _;
location / {
try_files $uri $uri/ /index.php?$args;
}
location /yggtracker {
root /var/www/YGGverse/YGGtracker/public;
rewrite ^/yggtracker/(.*)$ /$1 break;
try_files $uri @yggtracker;
}
location @yggtracker {
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/YGGverse/YGGtracker/public/index.php;
fastcgi_param SCRIPT_NAME /yggtracker/index.php;
fastcgi_param REQUEST_URI /yggtracker$uri?$args;
# Environment variables
# bin/console cache:clear
fastcgi_param APP_ENV prod;
}