nginx源码安装优化

环境:192.168.80.103 主机名zlf3 源码安装nginx服务
192.168.80.104 主机名zlf4 yum安装的apache服务

nginx 只支持静态网页,如果要支持动态网页的话,需要php-fpm模块

yum install gcc gcc-c++ make -y

systemctl stop firewalld
systemctl disable firewalld
setenforce 0
vi /etc/sysconfig/selinux 改为disabled

yum -y install pcre-devel zlib-devel

创建程序用户不指定家目录
useradd -M -s /sbin/nologin nginx

安装上传下载软件
yum install -y lrz*

tar xf nginx-1.8.1.tar.gz -C /opt/
cd /opt/nginx-1.8.1/

./configure
–prefix=/usr/local/nginx
–user=nginx
–group=nginx
–with-http_stub_status_module

make && make install

ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/ 将执行脚本nginx放到环境变量中方便后面直接使用nginx执行命令开启服务
ls -l /usr/local/sbin/nginx

在这里插入图片描述

nginx -t //配置文件语法检查
在这里插入图片描述

nginx //启动服务

netstat -anput | grep nginx
在这里插入图片描述

vi /etc/nginx.conf //还原配置文件修改server下配置
server_name www.bt.com;
charset utf-8;

开启日志相关的配置
错误日志
日志格式
访问日志

猜你喜欢

转载自blog.csdn.net/qeeezz11224/article/details/85595236