Recently debug public number function, do not want to submit to the server every time to read the log
So on the server with the Nginx reverse proxy to the server 80 port received the request forwarded to the 127.0.0.1:9000
Then using SSH to tunnel the server 9000 port mapped to my local development machine 80
SSH Tunnel Reference http://my.oschina.net/magicly007/blog/480706
Assume server external domain name www.site.com
The Nginx proxy configuration is roughly as follows:
server { listen 80; server_name www.site.com; root /var/www/site/; charset utf-8; access_log /www/log/nginx/site.access.log main; error_log /www/log/nginx/site.error.log; location / { try_files $uri $uri/ /$yii_bootstrap?$query_string; index index.php; proxy_pass http://127.0.0.1:9000; proxy_set_header Host $host:80; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Via "nginx"; } include /etc/nginx/php-fpm;}
Use the following command to create an SSH tunnel
ssh -R 9000:localhost:80 root@ServerAddress -N
So that the tunnel was built successfully.
The server successfully forwarded the request to the 80 port of my native localhost when I visited www.site.com on the local machine.
The problem is that you can only successfully forward www.site.com's default URL received content but not redirect
Suppose I access the Www.site.com/post/page server and I do not forward it but parse the response directly.
Does URL redirection need special configuration, please?
Reply content:
Recently debug public number function, do not want to submit to the server every time to read the log
So on the server with the Nginx reverse proxy to the server 80 port received the request forwarded to the 127.0.0.1:9000
Then using SSH to tunnel the server 9000 port mapped to my local development machine 80
SSH Tunnel Reference http://my.oschina.net/magicly007/blog/480706
Assume server external domain name www.site.com
The Nginx proxy configuration is roughly as follows:
server { listen 80; server_name www.site.com; root /var/www/site/; charset utf-8; access_log /www/log/nginx/site.access.log main; error_log /www/log/nginx/site.error.log; location / { try_files $uri $uri/ /$yii_bootstrap?$query_string; index index.php; proxy_pass http://127.0.0.1:9000; proxy_set_header Host $host:80; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Via "nginx"; } include /etc/nginx/php-fpm;}
Use the following command to create an SSH tunnel
ssh -R 9000:localhost:80 root@ServerAddress -N
So that the tunnel was built successfully.
The server successfully forwarded the request to the 80 port of my native localhost when I visited www.site.com on the local machine.
The problem is that you can only successfully forward www.site.com's default URL received content but not redirect
Suppose I access the Www.site.com/post/page server and I do not forward it but parse the response directly.
Does URL redirection need special configuration, please?
It should be an nginx configuration problem.
Try removing the Nginx extra settings, using only the simplest.
server { listen 80 default_server; client_max_body_size 10M; client_body_buffer_size 128k; server_name $host; index index.html; root /website/$host; location / { } location ~ /dev/ { rewrite /dev/(.*)$ /$1 break; proxy_pass http://localhost:3000; }}
This is what I am using, the situation is normal.
Personal doubts about the impact of PHP, try to remove it.
It was the try_files in Nginx that caused it to be deleted.