1.安装依赖:yum -y install gcc gcc-c++ make libtool zlib zlib-devel openssl openssl-devel pcre pcre-devel
2.下载Nginx安装包:wget -c https://nginx.org/download/nginx-1.18.0.tar.gz
3.解压,进入解压目录:
tar -zxvf nginx-1.18.0.tar.gz
cd nginx-1.18.0
4.配置安装运行目录:
./configure --prefix=/usr/local/nginx
5.出现如下错误需要安装依赖包:
yum -y install pcre-devel
yum -y install openssl openssl-devel
6.进行重新配置:
./configure --prefix=/usr/local/nginx
7.执行编译安装:
make && make install
8.安装完毕,进入Nginx下的sbin目录并启动nginx
cd /usr/local/nginx/sbin
启动nginx: sudo ./nginx
停止nginx: ./nginx -s stop
重启nginx: ./nginx -s reload
停止nginx(等待进程处理完毕进行关闭): ./nginx -s quit
Nginx.conf文件配置:https://www.cnblogs.com/ZMargo/articles/15216181.html
多二级域名配置nginx.conf文件:https://blog.csdn.net/weixin_44569100/article/details/126179849
server {
listen 80;
server_name musicland-adm.hikoon.com;
location / {
root /usr/local/nginx/html/dist1;
index index.html index.htm;
}
}
server {
listen 80;
server_name musicland-adm-test.hikoon.com;
location / {
root /usr/local/nginx/html/dist1;
index index.html index.htm;
}
}