栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

nginx部署

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

nginx部署

编译安装nginx

nginx安装包下载地址:http://nginx.org/en/download.html

1.下载nginx并且上传服务器 2.解压tar包

tar -zxvf nginx-1.20.1.tar.gz

3.编译配置

在nginx用户下编译nginx,设置nginx的编译安装目录为/home/nginx,临时目录为/home/nginx/tmp

./configure --prefix=/home/nginx 
    --with-http_gzip_static_module 
    --with-http_stub_status_module 
    --with-http_degradation_module 
    --with-http_v2_module 
    --with-http_ssl_module 
    --http-client-body-temp-path=/home/nginx/tmp/http-client-body-temp  
    --http-proxy-temp-path=/home/nginx/tmp/http-proxy-temp 
    --http-fastcgi-temp-path=/home/nginx/tmp/http-fastcgi-temp 
    --http-uwsgi-temp-path=/home/nginx/tmp/http-uwsgi-temp 
    --http-scgi-temp-path=/home/nginx/tmp/http-scgi-temp
make && make install

4.创建bin并且创建启动停止nginx脚本 1.启nginx脚本 start.sh
#!/bin/sh
cd ${HOME}/sbin
./nginx

[ "$?" -eq "0" ] && echo "nginx start success!"
2.停nginx脚本 stop.sh
#!/bin/sh
cd ${HOME}/sbin
./nginx -s stop

[ "$?" -eq "0" ] && echo "nginx stop success!"
3.重启nginx脚本 restart.sh
#!/bin/sh
cd ${HOME}/sbin
./nginx -s reload

[ "$?" -eq "0" ] && echo "nginx restart success!"
4.脚本赋权
cd ~/bin
chmod u+x *.sh
5. 创建临时tmp目录存储临时文件并且修改nginx.conf配置文件,监听端口为8080

6.启动使用默认配置启动nginx
cd ~/bin
./start.sh
7.测试

输入搭建主机的ip:port/index.html
即可查看nginx搭建完成

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/509850.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号