Nginx Basic Use
Download Source Package http://nginx.org/
Http://nginx.org/en/download.html
Yum- y install "@ Dev Tools" Pcre pcre-devel OpenSSL openssl-develtar-zxvf nginx-xxxx.tar.gz./configure--help ./configure--prefix=/usr/local/nginx--user=www--group=www--with-http_ssl_modulemake && make Installuseradd-s/sbin/nologin- m www
/usr/local/nginx/sbin/nginx option-h-s Stop Nginx process-V View software version-v configuration parameter when installing software-c specifies that the Nginx process uses that configuration file to run-t Check default configuration file nginx.conf for syntax errors
Pkill -9 Nginxkill signal PID number-int-quit-hup-usr1-usr2-winchkill -hup ' cat/usr/local/nginx/logs/nginx.pid '
Basic Web Services
HTTP {server {listen 80;server_name localhost;location/{root html;index index.html;} Location path {root Html;index index.html;}} server {}}
Domain-based virtual hosting: Publishing to public network clients
Port-based + IP-based: Publish Web site Admin page in private network
1. Domain Name Virtual host
server {Listen 80;server_name www.xzdz.hk;location/{root/wwwdir;index index.html index.htm;} ..........} server {Listen 80;server_name bbs.xzdz.hk;location/{Root/bbsdir;index index.html;}}
2. Port Virtual Host
server {Listen 80;location/{root html;index index.html;}} server {Listen 8000;location/{Root/bbsdir;index index.html;} server {Listen 8090;location/{Root/wwwdir;index index.html;}}
3.ip Virtual Host
server {Listen 1.1.1.253:8080;location/{Root/admindir;index index.html;}} server {Listen 1.1.1.254:80;location/{Root/wwwdir;index index.html;}} server {Listen 1.1.1.253:80;location/{Root/bbsdir;index index.html;}}
Nginx Basic Use