Nginx : Virtual Hostings2024/05/31 |
This is the Virtual Hostings configuration for Nginx. |
|
[1] | Configure Nginx. |
root@www:~#
vi /etc/nginx/sites-available/virtual.host.conf # create new server { listen 80; server_name www.virtual.host; location / { root /var/www/virtual.host; index index.html index.htm; } } mkdir /var/www/virtual.host root@www:~# cd /etc/nginx/sites-enabled root@www:/etc/nginx/sites-enabled# ln -s /etc/nginx/sites-available/virtual.host.conf ./ root@www:/etc/nginx/sites-enabled# systemctl reload nginx |
[2] | Create a test page to make sure it works normally. |
root@www:~#
vi /var/www/virtual.host/index.html <html> <body> <p style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> Nginx Virtual Host Test Page </p> </body> </html> |
Sponsored Link |