Virtual hosting in nginx is very simple :
see nginx.conf file
one server block is generally available there .
see
server {
listen 80;
server_name _;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
/root //html;
index index.html index.htm index.php ;
}
}
this is default server setting. that means from all doamains this will work .
for virtual hosting define new server block
:
server {
listen 80;
server_name yourdomain.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
/root /new_host;
index index.html index.htm index.php ;
}
}
now settings have been changed
just restart nginx and see
if traffic coming from yourdomain.com then it will point to /root/ new_host directory .
else it will go to /root/html directory and find related contents here.
thats it . it was very simple
ask me if u want any further help .
see nginx.conf file
one server block is generally available there .
see
server {
listen 80;
server_name _;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
/root //html;
index index.html index.htm index.php ;
}
}
this is default server setting. that means from all doamains this will work .
for virtual hosting define new server block
:
server {
listen 80;
server_name yourdomain.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
/root /new_host;
index index.html index.htm index.php ;
}
}
now settings have been changed
just restart nginx and see
if traffic coming from yourdomain.com then it will point to /root/ new_host directory .
else it will go to /root/html directory and find related contents here.
thats it . it was very simple
ask me if u want any further help .
No comments:
Post a Comment