先查看nginx进程:ps -ef | grep nginx
强制停止Nginx:pkill -9 nginx
cd /home/test下安装nginx
cd /home/test/ 接下面...
ifconfig
eth0 inet addr:192.168.2.10
server {
listen 192.168.2.10:80;
server_name localhost;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
root html;
index index.html index.htm;
}
}
server{
listen 192.168.2.10:80;
server_name www.abc.com;
location / {
root html;
index index.html index.htm;
}
}
server {
listen 192.168.2.10:80;
server_name tec.abc.com;
location / {
root /usr/local/nginx/tec;
index index.html index.htm;
}
}
注意hosts文件的位置:windows下C:\Windows\System32\drivers\etc\hosts,linux下/etc/hosts