摘要:編譯安裝所需要的等軟件不再贅述下載解壓切換到解壓后的目錄進行配置添加組添加用戶設置用戶名設置用戶組設置安裝位置用來監控的當前狀態打開功能允許改變客戶端請求頭中或等可用于記錄客戶編譯安裝
編譯安裝所需要的gcc等軟件不再贅述
1.下載Nginx
wget http://nginx.org/download/nginx-1.14.0.tar.gz
2.解壓
tar xf nginx-1.14.0.tar.gz
3.切換到解壓后的目錄, 進行配置
cd nginx-1.14.0 # 添加Nginx組 groupadd nginx # 添加Nginx用戶 useradd nginx -g nginx -s /sbin/nologin -M ./configure --user=nginx # 設置用戶名 --group=nginx # 設置用戶組 --prefix=/usr/local/nginx # 設置安裝位置 --with-http_stub_status_module # 用來監控 Nginx 的當前狀態 --with-http_ssl_module # 打開HTTPS功能 --with-http_realip_module # 允許改變客戶端請求頭中X-Real-IP 或 X-Forwarded-For等, 可用于記錄客戶IP --with-http_gzip_static_module
4.編譯安裝
make && make install
開機啟動和制作啟停工具
將下面的文件, 寫到/etc/init.d/nginx中
#!/bin/bash # nginx Startup script for the Nginx HTTP Server # # chkconfig: - 85 15 # description: Nginx is a high-performance web and proxy server. # It has a lot of features, but it"s not for everyone. # processname: nginx # pidfile: /var/run/nginx.pid # config: /usr/local/nginx/conf/nginx.conf nginxd=/usr/local/nginx/sbin/nginx nginx_config=/usr/local/nginx/conf/nginx.conf nginx_pid=/usr/local/nginx/nginx.pid RETVAL=0 prog="nginx" # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -x $nginxd ] || exit 0 # Start nginx daemons functions. start() { if [ -e $nginx_pid ];then echo "nginx already running...." exit 1 fi echo -n $"Starting $prog: " daemon $nginxd -c ${nginx_config} RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx return $RETVAL } # Stop nginx daemons functions. stop() { echo -n $"Stopping $prog: " killproc $nginxd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid } # reload nginx service functions. reload() { echo -n $"Reloading $prog: " $nginxd -s reload #if your nginx version is below 0.8, please use this command: "kill -HUP `cat ${nginx_pid}`" RETVAL=$? echo } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) stop start ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $prog {start|stop|restart|reload|status|help}" exit 1 esac exit $RETVAL
6.添加執行權限
chmod 755 /etc/init.d/nginx
7.開機自啟動
chkconfig --level 345 nginx on
參考文章: https://www.cnblogs.com/lucky...
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/40050.html
摘要:準備工作進入繼續操作編譯安裝庫下載安裝高版本會出現錯誤,建議選擇版本低一些,因為暫不支持,可以使用版本。編譯錯誤解決輸入命令,然后重新編譯。安裝庫下載安裝安裝解壓即可編譯安裝常用編譯選項說明指定的安裝目錄。默認情況下,該模塊沒有被構建。 原文來自http://www.hoohack.me/2016/01/27/compile-install-nginx-in-opensuse/ 下載源...
閱讀 2556·2021-09-22 15:25
閱讀 2963·2021-09-14 18:03
閱讀 1212·2021-09-09 09:33
閱讀 1700·2021-09-07 09:59
閱讀 2930·2021-07-29 13:50
閱讀 1500·2019-08-30 15:44
閱讀 1715·2019-08-29 16:22
閱讀 1287·2019-08-29 12:49