That is, I have a domain name ABC.com
One server and two website applications
The two website applications are hung on different ports
I have set up two domain names, A.ABC.com, B.ABC.com
Accessing A.ABC.com and B.ABC.com can point to these two applications.
How to configure
Similar to this
Another one:
In this way, the two requests can be forwarded to the corresponding local program ports. . . :)
You need to configure the virtual host so that Nginx listens to port 80 of different domain names and then forwards it to the actual port of the respective application
First, you need to edit the
/etc/nginx/nginx.conf
,在http
module to introduce other configuration files:include /etc/nginx/conf.d/*.conf;
This way you can set up each virtual host individually in a
/etc/nginx/conf.d
folder.Then create new files in the above folders
/etc/nginx/conf.d/a.conf
和/etc/nginx/conf.d/b.conf
,当然文件名a
,b
It’s up to you.Yes
b.abc.com
的应用只需要修改上面的server_name
That’s it.In this way, each request to access
http://a.abc.com
will be forwarded to the corresponding port and processed by the respective application.The domain name points to the same IP and is equipped with a corresponding virtual host
You can use Nginx’s reverse proxy