D
D
distmemory2019-06-22 12:07:26
Nginx
distmemory, 2019-06-22 12:07:26

Why the application and the admin panel are not launched on the same ip with this config?

I don’t fully understand what server_name should be for the admin panel so that there are no conflicts of duplicates. And how to access it from the Internet using this IP. There is a guess that the application call should be according to the classics: http://xxx.xxx.xxx.xxx, and the admin panel should be called like this http://xxx.xxx.xxx.xxx:port.
Configs:
Application:

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;
}

Admin:
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;
}

Error starting 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

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2019-06-22
@distmemory

nginx: [warn] server name "xxx.xxx.xxx.xxx" has suspicious symbols in /etc/nginx/vhosts/www-root/new.app.org.conf:2

It is clearly written what the problem is. Look at the second line.
The server name is the NAME (domain) or IP. Not a URL

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question