<p>problem description</p><p>By configuring nginx, you can set an ip address to access different web applications through different ports, but after a long time, the relationship between port numbers and applications becomes blurred.</p><p>For example, http://120.79.79.xx:9001 and foreign.xxx.xin, although both websites point to the same website, the latter is obviously more interesting than the former. At the same time, in website seo, the latter also has a higher weight than the former.</p><p>elementary knowledge</p><p>Top-level domain name: .com.cn</p><p>Second-level domain name: sina.com, baidu.com, in which baidu and sina are second-level domain names.</p><p>Third-level domain name: zhidao is the third-level domain name in zhidao.baidu.com.</p><p>Basic steps</p><p>Set address resolution</p><p>Configure nginx listening</p><p>Configure nginx jump</p><p>Create address resolution</p><p>Alibaba Cloud used by the author, after logging in to the Alibaba Cloud background, adds a record and fills the third-level domain name into the host record. For details, please refer to the following figure.</p><p><img src="https://freeonlinedomain.com/uploads/allimg/Server/20230911/vp4dplvqxw3110.jpg"/></p><p><img src="https://freeonlinedomain.com/uploads/allimg/Server/20230911/kw0qrxjc1ks111.jpg"/></p><p>Configure nginx</p><p>Modify the default file in/etc/nginx/sites-avilable, and the complete code is as follows:</p><p>server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html/wordpress; index index.php index.html index.htm index.nginx-debian.html ; server_name www.xxxx.xin; location / { try_files $uri $uri/ =404; } location ~ .php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; } location ~ /.ht { deny all; }} # Service2server {listen80; server_name foreign.xxx.xin; location / { proxy_pass http://120.79.xx.xx:9000/; }}</p><p>Both services are listening on the same port 80, but the server_name of service 2 is consistent with the newly set address resolution. Then set proxy_pass to forward the information obtained from port 80 to port 9000.</p>