Linux下安装Nginx
来源:互联网 发布:企业彩铃录音软件 编辑:程序博客网 时间:2024/03/28 18:39
1、安装准备
# yum install gcc-c++
# yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
# yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
标红的三个模块如果yum安装不了,也可以下载安装包安装
tar zxvf openssl-fips.tar.gz
cd openssl-fips
./config && make && make install
2、检查是否安装过nginx
# find -name nginx
./nginx
./nginx/sbin/nginx
./nginx-1.2.6/objs/nginx
3、卸载原有的Nginx
4、安装
上传文件
# cd /opt/local
# mkdir nginx
# tar -zxvf ../software/nginx-1.6.2.tar.gz
# cd nginx-1.6.2
# ./configure --prefix=/opt/local/nginx/sbin/nginx--with-http_stub_status_module --with-http_ssl_module --with-file-aio --with-http_realip_module 注:红色部分表示安装的路径
# make 编译
# make install 安装
# mkdir nginx
# tar -zxvf ../software/nginx-1.6.2.tar.gz
# cd nginx-1.6.2
# ./configure --prefix=/opt/local/nginx/sbin/nginx--with-http_stub_status_module --with-http_ssl_module --with-file-aio --with-http_realip_module 注:红色部分表示安装的路径
# make 编译
# make install 安装
5、启动
#方法1
# /opt/local/nginx/sbin/nginx -c /opt/local/nginx/sbin/nginx/conf/nginx.conf
#方法2
# /opt/local/nginx/sbin/nginx
6、停止
#查询nginx主进程号
ps -ef | grep nginx
#强制停止
pkill -9 nginx
7、重启(一半建议使用这个命令,如果配置错了。就不会更新)
# /opt/local/nginx/sbin/nginx -s reload
8、配置:Nginx.conf
location /mp_web/ {
proxy_pass http://192.168.51.209:9083/mp_web/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; #一般的web服务器用这个 X-Real-IP 来获取源IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.51.209:9083/mp_web/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; #一般的web服务器用这个 X-Real-IP 来获取源IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#如果nginx 服务器是作为反向代理服务器的,则这个配置项是必须的;否则看不到源IP
client_max_body_size 1024m;
}
client_max_body_size 1024m;
}
阅读全文
0 0
- nginx--linux下安装nginx
- linux 下nginx安装
- Linux下安装Nginx
- linux下安装nginx
- linux下安装nginx
- linux下安装nginx
- Linux下安装Nginx
- linux 下安装 nginx
- Linux下Nginx安装
- Linux下安装Nginx
- linux下安装nginx
- Linux下Nginx安装
- linux下nginx安装
- Linux下安装nginx
- linux下安装nginx
- linux下安装nginx
- linux下nginx安装
- linux 下安装nginx
- ubuntu 16.04 安装ROS Kinect v2的驱动
- python科学计算——数据可视化(2) Seaborn
- 【转载】推荐系统原理介绍
- hdu 1217 套利 (floyd多源最短路)
- 【Go学习】 逐行读写文件
- Linux下安装Nginx
- openlayer之加载wfs服务
- Java多线程系列--【基础篇08】- join()
- 【Java学习笔记】接口——基于Java SE8
- Makefile基础
- Micro Python 入门教程---第二个Micro Python 程序
- linux的jenkins安装与使用jenkins自动化打包maven项目部署到tomcat
- PHP从入门到精通 例6.6 应用正则表达式对用户注册信息进行验证
- linux vim编辑器