网站首页 > 技术教程 正文
- 上传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
猜你喜欢
- 2024-10-11 CentOS安装nginx并配置SSL证书(nginx安装ssl模块)
- 2024-09-19 linux下安装nginx(linux yum安装nginx)
- 2024-09-19 Linux(CentOS )手动搭建LNMP(Linux+Nginx+Mysql+PHP)坏境
- 2024-09-19 CentOS7.5安装nginx(centos7.5安装ftp服务)
- 2024-09-19 如何在阿里云Centos下安装Nginx(阿里云centos安装源)
- 2024-09-19 CentOS7编译安装Nginx(centos7编译安装gcc)
- 2024-09-19 Linux Centos7.4 Nginx的安装(linux nginx安装)
- 2024-09-19 Centos 7安装jdk+部署springboot项目+搭建配置nginx小白基础流程
- 2024-09-19 Nginx无脑小白教程之安装篇(Centos7&源码安装)
- 2024-09-19 centos 7 安装nginx(centos 7 安装黑屏)
你 发表评论:
欢迎- 最近发表
-
- Linux新手必看:几种方法帮你查看CPU核心数量
- linux基础命令之lscpu命令(linux中ls命令的用法)
- Linux lscpu 命令使用详解(linux常用ls命令)
- 如何查询 Linux 中 CPU 的数量?这几个命令要知道!
- 在linux上怎么查看cpu信息(linux如何查看cpu信息)
- 查看 CPU 的命令和磁盘 IO 的命令
- 如何在CentOS7上改变网卡名(centos怎么改网卡名字)
- 网工必备Linux网络管理命令(网工必备linux网络管理命令是什么)
- Linux 网络命令知多少(linux 网络 命令)
- Linux通过命令行连接wifi的方式(linux命令行连接无线网)
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)