prepare 1 sudo yum install -y gcc gcc-c++
1 sudo yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
root 安装PCRE库 1 2 3 4 5 6 cd /usr/local/ wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz tar -zxvf pcre-8.33.tar.gz cd pcre-8.33 ./configure make && make install
root 安装SSL库 1 2 3 4 5 6 cd /usr/local/ wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz tar -zxvf openssl-1.0.1j.tar.gz cd openssl-1.0.1j ./config make && make install
root 安装zlib库存 1 2 3 4 5 6 cd /usr/local/ wget http://www.zlib.net/zlib-1.2.11.tar.gz tar -zxvf zlib-1.2.11.tar.gz cd zlib-1.2.11 ./configure make && make install
set up nginx 1 2 3 4 5 6 cd /home/kube mkdir downloads cd downloads wget https://nginx.org/download/nginx-1.16.1.tar.gz tar xvf nginx-1.16.1.tar.gz
cd /home/kube/downloads/nginx-1.16.1
1 ./configure --prefix=/home/kube/apps/nginx --user=kube --group=kube --error-log-path=/home/kube/logs/nginx/error.log --http-log-path=/home/kube/logs/nginx/access.log --with-http_ssl_module --with-openssl=/usr/local/openssl-1.0.1j --with-pcre=/usr/local/pcre-8.33 --with-zlib=/usr/local/zlib-1.2.11 --with-http_stub_status_module
1 /home/kube/apps/nginx/sbin/nginx -V
login root 1 2 3 4 5 6 7 cd ~ cd /home/kube/apps/nginx/sbin sudo chown root nginx sudo chmod +s nginx cd ~ kube sudo rm -rf nginx-1.16.1 sudo rm nginx-1.16.1.tar.gz
或者normal account can start nginx at 80 port.
1 sudo /usr/sbin/setcap 'cap_net_bind_service=+ep' /home1/irteam/apps/nginx/sbin/nginx
nginx.conf 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 user root; worker_processes 2; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; gzip off; # gzip_min_length 1k # gzip_comp_level 4 # gzip_types text/plain text/css application/json application/javascript server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://localhost:3000; } error_page 404 /404.html; location = /404.html { root html; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
commands for the Nginx process 1 2 3 ./nginx # Start ./nginx -s reload ## Reload configure ./nginx -s stop ## End