Nginx : Virtual Hostings2025/01/30 |
|
This is the Virtual Hostings setting for Nginx. |
|
| [1] | Configure Nginx. |
|
[root@www ~]#
vi /etc/nginx/conf.d/virtual.host.conf # create new
server {
listen 80;
server_name www.virtual.host;
location / {
root /usr/share/nginx/virtual.host;
index index.html index.htm;
}
}
mkdir /usr/share/nginx/virtual.host [root@www ~]# systemctl reload nginx |
| [2] | Create a test page to verify it works normally. |
|
[root@www ~]#
vi /usr/share/nginx/virtual.host/index.html <html> <body> <h1 style="width: 100%; font-size: 48px; text-align: center;"> Nginx Virtual Host Test Page </h1> </body> </html> |
|
| Sponsored Link |
|
|