Не до конца понимаю, какое server_name должно стоять для админки, чтобы не было конфликтов дупликатов. И как к ней обращаться из интернета по этому ай-пи. Есть догадка, что вызов приложения должен быть по классике:
http://xxx.xxx.xxx.xxx, а админку вызывать так
http://xxx.xxx.xxx.xxx:порт.
Конфиги:
Приложение:
server {
server_name http://xxx.xxx.xxx.xxx/;
charset off;
index index.php index.html;
disable_symlinks if_not_owner from=$root_path;
include /etc/nginx/vhosts-includes/*.conf;
include /etc/nginx/vhosts-resources/new.app.org/*.conf;
access_log /var/www/httpd-logs/new.app.org.access.log;
error_log /var/www/httpd-logs/new.app.org.error.log notice;
ssi on;
set $root_path /var/www/www-root/data/www/new.app.org;
root $root_path;
location / {
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @fallback;
}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
try_files $uri $uri/ @fallback;
}
location / {
try_files /does_not_exists @fallback;
}
}
location @fallback {
proxy_pass http://127.0.0.1:5000;
proxy_redirect http://127.0.0.1:5000 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
access_log off;
}
listen xxx.xxx.xxx.xxx:80 default_server;
}
Админка:
server {
server_name http://xxx.xxx.xxx.xxx:4382/;
charset off;
index index.php index.html;
disable_symlinks if_not_owner from=$root_path;
include /etc/nginx/vhosts-includes/*.conf;
include /etc/nginx/vhosts-resources/admin.panel/*.conf;
access_log /var/www/httpd-logs/admin.panel.access.log;
error_log /var/www/httpd-logs/admin.panel.error.log notice;
ssi on;
set $root_path /var/www/www-root/data/www/admin.panel;
root $root_path;
location / {
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @fallback;
}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
try_files $uri $uri/ @fallback;
}
location / {
try_files /does_not_exists @fallback;
}
}
location @fallback {
proxy_pass http://127.0.0.1:4382;
proxy_redirect http://127.0.0.1:4382 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
access_log off;
}
listen xxx.xxx.xxx.xxx:80;
}
Ошибка при запуске NGINX:
nginx: [warn] server name "
xxx.xxx.xxx.xxx:4382" has suspicious symbols in /etc/nginx/vhosts/www-root/admin.panel.conf:2
nginx: [warn] server name "
xxx.xxx.xxx.xxx" has suspicious symbols in /etc/nginx/vhosts/www-root/new.app.org.conf:2