这篇文章主要讲解了“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这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。