How to run multiple sites on one web-server using Nginx by creating a virtual host.
Also shows how to host dynamic content using port 8080 and 8081
Free Trial on Digital Ocean: m.do.co/c/8add...
Helpful sites:
www.digitaloce...
nginx.org/en/do...
----------------------------------------------------------------------------------------------
commands used during video:
sudo apt install nginx
---show content in "site enable"
unlink default
-- create new conf file in conf.d
newsite.conf
--- past server block into .conf file
server {
listen 80 default_server;
server_name yourdomain1.xyz www.yourdomain1.xyz;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass localhost:8081;
}
}
server {
listen 80;
server_name yourdomain2.info www.yourdomain2.info;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_pass localhost:8080;
}
}
nginx -t
systemctl reload nginx
systemctl status nginux
Негізгі бет Run Multiple Site from one IP with reverse proxy Nginx
Пікірлер: 50