Selilnux , iptables 關掉html
yum -y groupinstall "開發工具" yum -y install gcc gcc-c++ pcre pcre-devel openssl openssl-devel
tar -zxf nginx-1.8.0.tar.gz cd nginx-1.8.0 useradd -s /sbin/nologin nginx ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module make && make install
ls /usr/local/nginx/
conf配置文件存放目錄nginx
html 網頁目錄 (/var/www//html)c++
logs 日誌文件存放目錄shell
sbin 存放啓動nginx進程的命令服務器
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf [root@squid nginx]# netstat -anptu |grep :80 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
/usr/local/nginx/sbin/nginx -v 查看nginx版本 tcp
/usr/local/nginx/sbin/nginx -V 查看編譯參數工具
/usr/local/nginx/sbin/nginx -t 測試默認配置文件開發工具
cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx1.conf 備份nginx的配置文件測試
/usr/local/nginx/sbin/nginx -s stopui
終止nginx進程 的方法
kill -9 pid號
pkill -9 nginx
TERM,INT 快速關閉
QUIT 從容關閉,關閉主進程及子進程
HUP 重載配置文件
USR1 從新打開日誌文件
USR2 平滑升級可執行程序
kill -HUP `cat /usr/local/nginx/logs/nginx.pid ` (重載配置文件)
/usr/local/nginx/sbin/nginx (開啓nginx)
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf (開啓nginx)
/usr/local/nginx/sbin/nginx -t /usr/local/nginx/conf/nginx.conf (測試nginx)
kill `cat /usr/local/nginx/logs/nginx.pid` (關閉nginx,殺死nginx進程)
/usr/local/nginx/sbin/nginx -s stop (關閉nginx)
tar -zxf nginx-1.9.2.tar.gz cd nginx-1.9.2 /usr/local/nginx/sbin/nginx -V ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module make mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/oldnginx cp objs/nginx /usr/local/nginx/sbin/ /usr/local/nginx/sbin/nginx -v make upgrade /usr/local/nginx/sbin/nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful kill -USR2 `cat /usr/local/nginx/logs/nginx.pid` sleep 1 test -f /usr/local/nginx/logs/nginx.pid.oldbin kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin` /user/local/nginx/sbin/nginx -t /usr/local/nginx/sbin/nginx -v
測試:
客戶端查看 指定端口8080
elinks --dump http://nginx服務器的ip:8080/test.html