linux nginx安装以及配置

一.Nginx安装包下载

地址:下载地址

二.使用命令下载

wget -c http://nginx.org/download/nginx-1.18.0.tar.gz

三.配置安装Nginx需要的环境

1.安装gcc

yum install gcc-c++

2. 安装PCRE pcre-devel

yum install -y pcre pcre-devel

3.安装zlib

yum install -y zlib zlib-devel

4.安装Open SSL

yum install -y openssl openssl-devel

5.解压
将压缩包解压到 /usr/local

tar -zxvf nginx-1.18.0.tar.gz

6.自定义配置
需要再/var下创建temp,Nginx目录

./configure
–prefix=/usr/local/nginx --with-http_ssl_module
–conf-path=/usr/local/nginx/conf/nginx.conf
–pid-path=/usr/local/nginx/conf/nginx.pid
–lock-path=/var/lock/nginx.lock
–error-log-path=/var/log/nginx/error.log
–http-log-path=/var/log/nginx/access.log
–with-http_gzip_static_module
–http-client-body-temp-path=/var/temp/nginx/client
–http-proxy-temp-path=/var/temp/nginx/proxy
–http-fastcgi-temp-path=/var/temp/nginx/fastcgi
–http-uwsgi-temp-path=/var/temp/nginx/uwsgi
–http-scgi-temp-path=/var/temp/nginx/scgi

7.编译

make install

8.运行Nginx

cd /usr/local/nginx/sbin/
./nginx 开启
./nginx -s stop 停止
./nginx -s quit 退出
./nginx -s reload 重启

9.Nginx配置文件
注:操作Nginx配置文件注意备份

cd /usr/local/nginx/conf
less nginx.conf

10.设置开启启动Nginx

vi /etc/rc.local

添加配置

/usr/local/nginx/sbin/nginx

给文件赋权

chmod 755 /etc/rc.local

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值