這篇文章主要講解了“centos 怎么安裝 nginx”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“centos 怎么安裝 nginx”吧!
創(chuàng)新互聯(lián)建站專業(yè)為企業(yè)提供蒼梧網(wǎng)站建設(shè)、蒼梧做網(wǎng)站、蒼梧網(wǎng)站設(shè)計、蒼梧網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計與制作、蒼梧企業(yè)網(wǎng)站模板建站服務(wù),十年蒼梧做網(wǎng)站經(jīng)驗,不只是建網(wǎng)站,更提供有價值的思路和整體網(wǎng)絡(luò)服務(wù)。
nginx官網(wǎng)里下載 nginx-1.18.0.tar.gz
上傳至服務(wù)器目錄
解壓 進入目錄
yum -y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel
./configure --prefix=/opt/nginx --with-http_ssl_module
make & make install
進入軟件目錄 /opt/nginx/
啟動 sbin目錄下 ./nginx
重啟 ./nginx -s reload
配置文件示例
user root; worker_processes 1; #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 on; # HTTPS server # server { listen 80; listen 443 ssl; server_name domain.com; client_max_body_size 100M; ssl_certificate ssl/xxx.pem; ssl_certificate_key ssl/xxx.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location /test/ { proxy_pass http://ip:port/; } location /service-test/ { proxy_pass http://ip:port/; } location /job/ { proxy_pass http://ip:port/; } location / { root /home/page/admin/; index index.html; } } }
感謝各位的閱讀,以上就是“centos 怎么安裝 nginx”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對centos 怎么安裝 nginx這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!