ngnix之虛擬主機

[root@localhost ngnix]# ./sbin/nginx -h
nginx version: nginx/1.4.2
Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]

Options:
  -?,-h         : this help
  -v            : show version and exit
  -V            : show version and configure options then exit
  -t            : test configuration and exit
  -q            : suppress non-error messages during configuration testing
  -s signal     : send signal to a master process: stop, quit, reopen, reload
  -p prefix     : set prefix path (default: /usr/local/ngnix/)
  -c filename   : set configuration file (default: conf/nginx.conf)
  -g directives : set global directives out of configuration file

  [root@localhost ngnix]# ./sbin/nginx -s reload
  [root@localhost ngnix]# ./sbin/nginx -s stop
  [root@localhost ngnix]# ps aux |grep nginx
root      3029  0.0  0.0 103256   832 pts/0    S+   18:02   0:00 grep nginx
[root@localhost ngnix]# ps aux |grep nginx
root      3033  0.0  0.0  20292   608 ?        Ss   18:03   0:00 nginx: master process ./sbin/nginx
nobody    3034  0.0  0.1  20688  1160 ?        S    18:03   0:00 nginx: worker process
root      3036  0.0  0.0 103256   828 pts/0    S+   18:03   0:00 grep nginx

[root@localhost ngnix]# ./sbin/nginx
[root@localhost ngnix]# ps aux |grep nginx
root      3033  0.0  0.0  20292   608 ?        Ss   18:03   0:00 nginx: master process ./sbin/nginx
nobody    3034  0.0  0.1  20688  1160 ?        S    18:03   0:00 nginx: worker process
root      3036  0.0  0.0 103256   828 pts/0    S+   18:03   0:00 grep nginx
[root@localhost ngnix]# ./sbin/nginx -s reopen  重讀配置文件
[root@localhost ngnix]# ps aux |grep nginx
root      3033  0.0  0.0  20292   664 ?        Ss   18:03   0:00 nginx: master process ./sbin/nginx
nobody    3034  0.0  0.1  20688  1216 ?        S    18:03   0:00 nginx: worker process
root      3042  0.0  0.0 103256   832 pts/0    S+   18:03   0:00 grep nginx
[root@localhost ngnix]# vi conf/nginx.conf
server{
      listen    80;
      server_name z.com;
      location /{
        root z.com;
        index index.html;
}
}
[root@localhost ngnix]# ./sbin/nginx -s reload
[root@localhost ngnix]#
C:\Windows\System32\drivers\etc\hosts
192.168.88.173 z.com


[root@localhost ngnix]# mkdir z.com
[root@localhost ngnix]# vi z.com/index.html<16:16>
<html>
this is z.com
/html>
打開瀏覽器http://z.com/
出現了
this is z.com /html>
[root@localhost ngnix]#
新加server
server{
      listen    2022;
      server_name z.com;
      location /{
        root /var/www/html;
        index index.html;
}
}
[root@localhost html]# vi /var/www/html/index.html
<html>
  welcom to z.com chanal

</html>





html

相關文章
相關標籤/搜索