For example, there are two different projects developed by PHP and Ruby respectively and want to use them on the same server.
URL of PHP project:
http://site1.com
Ruby project URL:
http://site2.com
There is a port problem here, the default is 80. It is of course no problem to add another port after another URL to access, but if not, how to use Web Server settings?
Apache and Nginx both work. Is there a solution?
Use nginx reverse proxy to change one of the listening ports to another port, add a virtual host to nginx, and then reverse proxy it
Both nginx and apache can directly create two virtual hosts, just use different directories, which is equivalent to putting two websites on one server. It is very simple.
Two server nodes are configured in nginx, both listening 80, but the server_name is different
Just set up different virtual hosts, this is true for both nginx and apache.