Install nginx on azure cloud

  
        You can install libevent before installing nginx. The steps to install libevent are as follows: 1. Download libevent:wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz2. Unzip libevent:tar -zxvpf libevent-2.0.21-stable.tar.gz3. Enter the decompression directory: cd libevent-2.0.21-stable4. Specify the installation directory: ./configure --prefix=/usr/local/libevent-2.0.215. Install Libevent: makemake install6, install nginxyum install -y openssl*tar -xvf pcre-8.31.tar.gz -C /usr/local/tar -xvf nginx-1.4.2.tar.gzcd nginx-1.4.2./configure - -with-http_ssl_module --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre-8.31 --with-http_stub_status_modulepS:Chief Compilation Script 1.121/122yum -y install gcc automake autoconf libtool make./Configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_realip_module --with-http_gzip_static_module --with-http_ssl_module --with-pcre=/usr/local/pcre-8.31makemake install

7, view the compilation parameters:

/usr/l Ocal/nginx/sbin/nginx -V
8, use set nginx account to start setcap CAP_NET_BIND_SERVICE=+ep /usr/local/nginx/sbin/nginx first run /usr/local/nginx/sbin/nginx with root account Then kill the nginx process and then switch to the nginx account to execute service nginx restart or /usr/local/nginx/sbin/nginx to start, you will see that the process is started with nginx account 9, error debugging [nginx@lb_net_1 ~] $ service nginx startstart nginxnginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied) nginx is running[nginx@lb_net_1 ~]$[nginx@lb_net_1 ~]$ exitlogout[root@lb_net_1 conf]# [root@lb_net_1 conf]# sudo chown root:wheel /usr/local/nginx/sbin/nginx[root@lb_net_1 conf]# sudo chmod u+s /usr/local/nginx/sbin/nginx[root@lb_net_1 conf] #[root@lb_net_1 conf]# su - nginx[[root@lb_net_1 conf]# sudo chmod u+x /usr/local/nginx/sbin/nginx After entering the nginx account, it started successfully.zh-CN"],null,[0.98146433],zh-CN"]]]

Copyright © Windows knowledge All Rights Reserved