作者:live科_722 | 来源:互联网 | 2017-05-13 02:18
只需配置如下:
server {
listen 80;
server_name localhost;
server_name_in_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if ($host = 'www.xxx.com' ) {
rewrite ^/(.*)$ http://xxx.com/$1 permanent;
}
location / {
proxy_pass http://127.0.0.1:8080/;
}
}
以上就介绍了使用Nginx实现301重定向详解,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。