Nginx
Nginx
1.安装依赖环境
yum install gcc-c++
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
yum -y install openssl openssl-devel
2.安装Nginx
./configure
make
make install
安装后在/usr/local下就会有一个nginx目录
3.启动Nginx
cd /usr/local/nginx/sbin
启动
./nginx
查看服务状态
ps -ef | grep nginx
停止
./nginx -s stop
重启
./nginx -s reload
4.测试Nginx服务
http://ip地址:80
5.发布项目
- 将资料上传至/usr/local/nginx/html下
- 编辑Nginx配置文件nginx-1.17.5/conf/nginx.conf
server {
listen 80; #监听的端口
server_name localhost;#域名或ip
location / {#访问路径配置
root html;# 根目录
index index.html index.htm; #默认首页
}
道阻且长,行则将至