Z
Z
Z0nd0R2013-03-14 10:39:41
PHP
Z0nd0R, 2013-03-14 10:39:41

nginx -> nginx + fastcgi extra port substitution

Good day!

At home, I set up a server and an incomprehensible thing happens.

The Internet is connected through a router. From the router, from port 80, the request is sent to the computer, which acts as a repository and part-time http proxy (nginx).
There is also a working machine, it has nginx + fastcgi

The problem is this:
php, apparently, when it takes server host, it gets not just a domain, but also an extra port, as a result it turns out like this sub.domain.zone:8080/catalog
Therefore none of the links open. Tell me how can I remove this port?

A piece of the config on the proxy server:

server {
listen 80;
server_name sub.domain.zone www.sub.domain.zone;

location / {
proxy_pass 192.168.1.1 :8080;
proxy_redirect sub.domain.zone :8080 sub.domain.zone; #I already substituted this when looking for a solution, proxy_set_header does not help
Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
}
}


A piece of code on a working machine
server {
listen 192.168.1.1:8080;
server_name sub.domain.zone www.sub.domain.zone;

access_log G:/var/www/domain/data/logs/sub.domain.zone.access_log;
error_log G:/var/www/domain/data/logs/sub.domain.zone.error_log;

root G:/var/www/domain/data/www/sub.domain.zone;
index index.php;

location / {
root G:/var/www/domain/data/www/sub.domain.zone;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:9123;
fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_ignore_client_abort on;
include fastcgi_params;
#include fastcgi.conf;
fastcgi_param SERVER_NAME $http_host;
}

location ~ /\.ht {
deny all;
}

autoindex off;
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
avalak, 2013-03-14
@Z0nd0R

fastcgi_param SERVER_PORT 80;

S
script88, 2013-03-14
@script88

proxy_redirect http://site.ru:8080/ /;

something like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question