centos怎么安装nginx
这篇文章主要讲解了“centos 怎么安装 nginx”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“centos 怎么安装 nginx”吧!
创新互联建站专业为企业提供苍梧网站建设、苍梧做网站、苍梧网站设计、苍梧网站制作等企业网站建设、网页设计与制作、苍梧企业网站模板建站服务,十年苍梧做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
nginx官网里下载 nginx-1.18.0.tar.gz
上传至服务器目录
解压 进入目录
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”的内容了,经过本文的学习后,相信大家对centos 怎么安装 nginx这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!
本文题目:centos怎么安装nginx
分享网址:http://myzitong.com/article/pshhpj.html