In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Steps of installing, compiling and installing Nginx under Linux 6
Foreword:
Nginx is a high-performance HTTP and reverse proxy server, as well as an IMAP/POP3/SMTP server. In the case of high connection concurrency, Nginx is a good alternative to Apache servers: Nginx is one of the software platforms often chosen by web hosting bosses in the United States. It can support responses of up to 50000 concurrent connections with minimal memory overhead. This is also an important reason why Nginx is so popular. This article demonstrates the compilation and installation of Nginx based on Linux 6 for your reference.
I. installation environment
# cat / etc/issueRed Hat Enterprise Linux Server release 6.3 (Santiago) Kernel\ r on an\ m # nginx-vnginx version: nginx/1.8.0
2. Configure the installation environment
# to simplify installation and configuration, the firewall is turned off here. It is recommended to enable # service iptables stop# chkconfig iptables off# vi / etc/selinux/config SELINUX=disabled### to create users and groups # groupadd-r nginx#useradd-s / sbin/nologin-g nginx-r nginx### installation environment dependency package http://nginx.org/en/linux_packages.html# yum install pcre-devel zlib-devel openssl openssl-devel gcc gcc-c++
III. Compile and install 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" # if the apache httpd service starts It is recommended to stop or change the port number # service httpd stop# mkdir-p / var/cache/nginx/ {client_temp,proxy_temp,fastcgi_temp,uwsgi_temp first. Scgi_temp} # make & & make install### launch nginx# / usr/sbin/nginx-c / etc/nginx/nginx.conf# ps-ef | grep nginx | grep-v greproot 33412 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 00 0.0.0.0: 80 0.0.0.0 LISTEN 33412/nginx [root@orasrv1 cache] #
Configure nginx to serve the system
Vi / etc/init.d/nginx #! / bin/bash# nginx Startup script for the Nginx HTTP Server# chkconfig:-85 "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 nginx_pid 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 | help}" exit 1esacexit $RETVAL# chmod uplix / etc/init.d/nginx # service nginx startStarting nginx: [OK] # ps-ef | grep nginx | grep-v greproot 33534 10 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
Common failures in the process of installation
. / 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= 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= option.### the above 2 errors Please install the corresponding dependency package, see the second part of this article: configure the installation environment # / usr/sbin/nginxnginx: [emerg] getpwnam ("nginx") failed### needs to create nginx user groups and users # / usr/sbin/nginxnginx: [emerg] mkdir () "/ var/cache/nginx/client_temp" failed (2: No such file or directory) # need to create corresponding directories
If you have any questions, please leave a message or go to the community to exchange and discuss, thank you for reading, hope to help you, thank you for your support!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.