Answer the question
In order to leave comments, you need to log in
Why is the port number added to the resource address on which the nginx virtual host is running?
There is a bunch:
frontend: proxying to several virtual machines from the same IP address nginx
backend: nginx Frontend
configuration - etc/nginx/sites-enable/site_pro.conf
server {
listen 192.168.1.7:80;
#access_log /var/log/nginx/proxy.log;
server_name site.pro;
server_name_in_redirect on;
location / {
proxy_pass http://192.168.1.11:8082;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
set_real_ip_from 0.0.0.0/0;
}
}
upstream backend-site_pro {server unix:/var/run/php5-site_pro.sock;}
server {
listen 8082;
server_name localhost;
root /var/www/site_pro/www;
access_log /var/log/nginx/site_pro-access.log;
error_log /var/log/nginx/site_pro-error.log;
index index.php;
rewrite_log on;
location /core/ { $
deny all; $
}
location / {
try_files $uri $uri/ @rewrite;
}
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass backend-site_pro;
}
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|bmp)$ {
access_log off;
expires 10d;
break;
}
location ~ /\.ht {
deny all;
}
set_real_ip_from 192.168.1.7;
real_ip_header X-Forwarded-For;
}
Answer the question
In order to leave comments, you need to log in
These are the features of the engine - it determines the domain name and substitutes it in all links, and the "back" nginx informs the puff of the host with the added port. This is what many do.
The solution is to add the correct http_host (or whatever it is) to fastcgi_param in nginx.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question