I'm on CentOS 8 my nginx configuration file is in /etc/nginx/nginx.conf
I don't have any DNS therefore I would just use the server ip to access the server, I search a way for host two website in one Nginx server (without DNS)
Thank you for your help :))
Ps. I think the best way is using two differents ports, but I don't know how
I think your options are
Use two different ports, for example:
If you have SELinux enabled system, ports used for this configuration must be labeled as
http_port_ttype, otherwise nginx won't be able to bind on those ports. You can check avaliablehttp_port_tports withcommand. To label some new port with
http_port_ttype (for example, port 81), useDo not forget to open used ports for external access via your firewall.
Serve the second site under some URI prefix, for example, use
http://<ip>/for the first site andhttp://<ip>/blog/for the second one:Using this configuration could be tricky because every link on your site #2 must be either relative or start with
/blog/prefix, otherwise that link won't be served withlocation /blog/ { ... }block therefore leading to site #1.