web服务器-Nginx安装部署
nginx源码下载
- 官网: http://nginx.org/
- http://nginx.org/download/nginx-1.17.3.tar.gz
- 源码包下载: wget http://nginx.org/download/nginx-1.17.3.tar.gz
二 nginx安装
- 下载依赖
yum install gcc pcre-devel zlib-devel
# 下载
wget http://nginx.org/download/nginx-1.17.3.tar.gz
# 解压nginx
tar -xf nginx-1.17.3.tar.gz
cd nginx-1.17.3
./configure --prefix=/usr/local/nginx
配置目的
配置目的:
1)检查环境 是否 满足安装条件 依赖解决
2)指定安装方式 配置文件 命令文件 各种文件放哪里 开启模块功能【内置模块 三方模块】
3)指定软件安装在那里
# 编译
make
make install
三 nginx相关目录
-
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx modules path: "/usr/local/nginx/modules"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
四 nginx启动管理
-
配置文件测试
/usr/local/nginx/sbin/nginx -t #测试 /usr/local/nginx/sbin/nginx # 启动 killall -s QUIT nginx # 关闭 /usr/local/nginx/sbin/nginx -s reload/stop # 重载/停止
五. nginx测试
查看端口
netstat -ntpl
lsof -i :80
elinks http://192.168.157.15