- 上传pcre-devel-7.8-7.el6.x86_64.rpm至服务器;
- 执行rpm –iv pcre-devel-7.8-7.el6.x86_64.rpm;非root账号 sudo rpm –iv pcre-devel-7.8-7.el6.x86_64.rpm
- 上传nginx-1.13.6至服务器
- 执行 ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_stub_status_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --without-http_gzip_module --with-pcre
- 成功后,执行make,若失败重新执行上一步
- 成功后,执行make install
- /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
- 可能出现 nginx: [emerg] getpwnam("nginx") failed 错误,因为服务器上没有添加nginx用户组,执行 [root@localhost nginx-1.11.2]# useradd -s /sbin/nologin -M nginx
- [root@localhost nginx-1.11.2]# id nginx
- [root@localhost nginx-1.11.2]# /usr/local/nginx/sbin/nginx
- [root@localhost nginx-1.11.2]# netstat -tlunp | grep nginx
- 若出现nginx: [emerg] mkdir() "/var/tmp/nginx/client/" failed (2: No such file or directory),可手动新建此目录
- nginx配置:
- cd /usr/local/nginx/conf
- 打开nginx.conf文件,在Server{}加入配置
#静态资源目录
location ~ .*\.(js|css|ico|png|jpg|eot|svg|ttf|woff|html|gif) {
root /home/docker/scf;
index index.html index.htm;
}
#用户注册登录模块
location /jwt/ {
index index.html index.htm;
proxy_pass http://10.220.160.103:8760/jwt/;#正式环境切换为服务器ip
}
#业务路径
location /api/ {
index index.html index.htm;
proxy_pass http://10.220.160.103:8760/api/;#正式环境切换为服务器ip
}
#上传文件前端访问路径配置,正式环境root配置为mount公共目录
location ^~ /file/ {
root /home/upload/;
}
开放linux防火墙端口
添加防火墙规则:sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT
保存防护区规则:sudo /etc/rc.d/init.d/iptables save
重启防火墙生效规则:sudo service iptables restart
查看规则表: iptables -L –n
本文暂时没有评论,来添加一个吧(●'◡'●)