nginx non-port 80 virtual host
習慣沉默
習慣沉默 2017-05-16 17:20:42
0
2
484

Excuse me, my nginx can only run on non-80 ports
So how do I forward the domain name to this non-80 port
For example, as follows:

    listen 8000;
    server_name  abc.test www.abc.test;

    location / {
            root /home/www/abc.test;
            index index.html index.htm;

            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Host $http_host;

            if ($http_host = "www.abc.test") {
                     proxy_pass http://127.0.0.1:8000;
            }

            if ($http_host = "abc.test") {
                    proxy_pass http://127.0.0.1:8000;
            }
習慣沉默
習慣沉默

reply all(2)
仅有的幸福

If your Nginx is listening on port 8000, then you need to find a way to forward port 80, similar to:

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
大家讲道理

If there is no registration, just set up an off-wall server and then link to 8000 through nginx

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!