麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 服務器 > Linux服務器 > 正文

Linux 6下安裝編譯安裝Nginx的步驟

2024-09-05 23:04:16
字體:
來源:轉載
供稿:網友

Linux 6下安裝編譯安裝Nginx的步驟

前言:

Nginx是一個高性能的HTTP和反向代理服務器,也是一個IMAP/POP3/SMTP服務器。在高連接并發的情況下,Nginx是Apache服務器不錯的替代品:Nginx在美國是做虛擬主機生意的老板們經常選擇的軟件平臺之一。能夠支持高達50,000個并發連接數的響應,而且內存開銷極小。這也是Nginx廣受歡迎的重要原因。本文演示了基于Linux 6下編譯安裝Nginx,供大家參考。

一、安裝環境

# cat /etc/issueRed Hat Enterprise Linux Server release 6.3 (Santiago)Kernel /r on an /m# nginx -vnginx version: nginx/1.8.0

二、配置安裝環境

###為簡化安裝及配置,此處關閉了防火墻,生產環境建議開啟# service iptables stop# chkconfig iptables off# vi /etc/selinux/config SELINUX=disabled###創建用戶及組#groupadd -r nginx#useradd -s /sbin/nologin -g nginx -r nginx###安裝環境依賴包 http://nginx.org/en/linux_packages.html# yum install pcre-devel zlib-devel openssl openssl-devel gcc gcc-c++

三、編譯及安裝Nginx

# cd /tmp/# tar -xvf nginx-1.8.0.tar.gz# cd /nginx-1.8.0# ./configure           /--prefix=/etc/nginx                     /--sbin-path=/usr/sbin/nginx                 /--conf-path=/etc/nginx/nginx.conf              /--error-log-path=/var/log/nginx/error.log          /--http-log-path=/var/log/nginx/access.log          /--pid-path=/var/run/nginx.pid                /--lock-path=/var/run/nginx.lock               /--http-client-body-temp-path=/var/cache/nginx/client_temp  /--http-proxy-temp-path=/var/cache/nginx/proxy_temp      /--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp    /--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp      /--http-scgi-temp-path=/var/cache/nginx/scgi_temp       /--user=nginx                         /--group=nginx                        /--with-http_ssl_module                    /--with-http_realip_module                  /--with-http_addition_module                 /--with-http_sub_module                    /--with-http_dav_module                    /--with-http_flv_module                    /--with-http_mp4_module                    /--with-http_gunzip_module                  /--with-http_gzip_static_module                /--with-http_random_index_module               /--with-http_secure_link_module                /--with-http_stub_status_module                /--with-http_auth_request_module               /--with-mail                         /--with-mail_ssl_module                    /--with-file-aio                       /--with-http_spdy_module                   /--with-ipv6                         Configuration summary + using system PCRE library + using system OpenSSL library + md5: using OpenSSL library + sha1: using OpenSSL library + using system zlib library nginx path prefix: "/etc/nginx" nginx binary file: "/usr/sbin/nginx" nginx configuration prefix: "/etc/nginx" nginx configuration file: "/etc/nginx/nginx.conf" nginx pid file: "/var/run/nginx.pid" nginx error log file: "/var/log/nginx/error.log" nginx http access log file: "/var/log/nginx/access.log" nginx http client request body temporary files: "/var/cache/nginx/client_temp" nginx http proxy temporary files: "/var/cache/nginx/proxy_temp" nginx http fastcgi temporary files: "/var/cache/nginx/fastcgi_temp" nginx http uwsgi temporary files: "/var/cache/nginx/uwsgi_temp" nginx http scgi temporary files: "/var/cache/nginx/scgi_temp"###如果apache httpd服務啟動,建議先停止或更改端口號# service httpd stop# mkdir -p /var/cache/nginx/{client_temp,proxy_temp,fastcgi_temp,uwsgi_temp,scgi_temp}# make && make install###啟動nginx# /usr/sbin/nginx -c /etc/nginx/nginx.conf# ps -ef|grep nginx|grep -v greproot   33412   1 0 10:18 ?    00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.confnginx   33413 33412 0 10:18 ?    00:00:00 nginx: worker process[root@orasrv1 cache]# netstat -nltp|grep 80tcp    0   0 0.0.0.0:80         0.0.0.0:*          LISTEN   33412/nginx     [root@orasrv1 cache]# 

四、配置nginx為系統服務

vi /etc/init.d/nginx #!/bin/bash# nginx Startup script for the Nginx HTTP Server# chkconfig: - 85 15# description: Nginx is an HTTP(S) server, HTTP(S) reverse /#        proxy and IMAP/POP3 proxy server# Author : Leshami# Blog  : http://blog.csdn.net/leshami      # processname: nginx# pidfile: /var/run/nginx.pid# config: /etc/nginx/nginx.conf#path for nginx binarynginxd=/usr/sbin/nginx#path for nginx configurationnginx_config=/etc/nginx/nginx.conf#path for nginx pidnginx_pid=/var/run/nginx.pidRETVAL=0prog="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 1fi  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: "  #kill -HUP `cat ${nginx_pid}`  killproc $nginxd -HUP  RETVAL=$?  echo}# See how we were called.case "$1" instart)    start    ;;stop)    stop    ;;reload)    reload    ;;restart)    stop    start    ;;status)    status $prog    RETVAL=$?    ;;*)    echo $"Usage: $prog {start|stop|restart|reload|status|help}"    exit 1esacexit $RETVAL# chmod u+x /etc/init.d/nginx # service nginx startStarting nginx:                      [ OK ]# ps -ef|grep nginx |grep -v greproot   33534   1 0 10:33 ?    00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.confnginx   33535 33534 0 10:33 ?    00:00:00 nginx: worker process  # service nginx stopStopping nginx:                      [ OK ]# chkconfig --add nginx# chkconfig nginx on

五、安裝過程中的常見故障

./configure: error: the HTTP rewrite module requires the PCRE library.You can either disable the module by using --without-http_rewrite_moduleoption, or install the PCRE library into the system, or build the PCRE librarystatically from the source with nginx by using --with-pcre=<path> option../configure: error: the HTTP gzip module requires the zlib library.You can either disable the module by using --without-http_gzip_moduleoption, or install the zlib library into the system, or build the zlib librarystatically from the source with nginx by using --with-zlib=<path> option.### 以上2個錯誤,請安裝相應的依賴包,見本文第二部分:配置安裝環境# /usr/sbin/nginx nginx: [emerg] getpwnam("nginx") failed### 需要創建nginx用戶組及用戶# /usr/sbin/nginxnginx: [emerg] mkdir() "/var/cache/nginx/client_temp" failed (2: No such file or directory)### 需要創建對應的目錄

如有疑問請留言或者到本站社區交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 成人福利在线观看 | 欧美成人高清视频 | 欧美老逼| 欧美日韩免费看 | 激情综合婷婷久久 | 久久久aa| 狠狠干最新网址 | 国产精品久久久久影院老司 | 国产成年人在线观看 | 亚洲成人精品久久久 | 久久成人精品视频 | 久久精品一区二区三区国产主播 | 一级做a爱视频 | 中国毛片在线观看 | av电影直播| 日本黄色免费播放 | 看全色黄大色黄大片女图片 | 成人激情视频网 | 午夜影院在线免费观看 | 少妇av片| 欧美一级视频免费看 | 最新福利在线 | 中文日产幕无线码6区免费版 | 欧美日韩在线播放一区 | 在线播放免费人成毛片乱码 | 久久伊人国产精品 | 综合国产在线 | 精品一区二区久久久久久久网精 | 国产免费激情视频 | 久草在线播放视频 | 欧美一级特黄aaaaaaa什 | 久久久久久久久久久久免费 | 亚洲福利在线免费观看 | 91av日韩| 欧美精品久久久久久久久久 | 国产成人精品日本亚洲语音 | 国产二区三区在线播放 | 国产精品视频一区二区三区四区五区 | 欧美大片一级毛片 | 中文字幕在线第二页 | 亚洲综合91 |