centos 6.6编译安装nginx
nginx 安装
安装前必要软件准备
1)安装pcre、gzip 等
为了支持rewrite功能,我们需要安装pcre
# yum install -y pcre* zlib zlib-devel openssl-devel

2)下载
wget http://nginx.org/download/nginx-1.8.0.tar.gz
2)解压切到目录下
# tar zxvf nginx-1.8..tar.gz
3)编译安装
创建nginx安装目录:
mkdir /data/nginx
进入nginx编译文件目录,编译文件
# cd nginx-1.8.0
# ./configure \ --prefix=/data/nginx \ 指向安装目录 --sbin-path=/usr/sbin/nginx \ 指向(执行)程序文件(nginx --conf-path=/etc/nginx/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 \ 指向pid文件(nginx.pid) --lock-path=/var/lock/nginx.lock \ 指向lock文件(nginx.lock)(安装文件锁定,防止安装文件被别人利用,或自己误操作。) --user=user \ 指定程序运行时的用户 --group=nobody \ 指定程序运行时的用户组 --with-http_ssl_module \ 支持openssl --with-http_flv_module \ 启用ngx_http_flv_module支持 --with-http_stub_status_module \ 启用ngx_http_stub_status_module支持(获取nginx自上次启动以来的工作状态) --with-http_gzip_static_module \ 在线实时压缩输出数据流 --http-client-body-temp-path=/var/tmp/nginx/client/ \ 设定http客户端请求临时文件路径 --http-proxy-temp-path=/var/tmp/nginx/proxy/ \ 设定http代理临时文件路径 --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \ 设定http fastcgi临时文件路径 --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \ 设定http uwsgi临时文件路径 --http-scgi-temp-path=/var/tmp/nginx/scgi \ 设定http scgi临时文件路径
4)make 和 make install
# make && make install

5)启动nginx
# cd /data/nginx/sbin # ./nginx
使用命令看nginx已经启动并监听了80端口
# netstat -ntulp | grep ""

使用命令来测试,可以看到nginx已经成功提供服务
# curl -s http://localhost | grep nginx

或者直接在浏览器访问网站的80端口:

nginx安装完成 ^_^
nginx配置
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout ;
gzip on;
server {
server_name www.abc.cn;
listen ssl;
ssl_certificate /data/cert/1697401_www.abc.cn.pem;
ssl_certificate_key /data/cert/1697401_www.abc.cn.key;
proxy_redirect http:// $scheme://;
location / {
client_max_body_size 100m;
client_body_buffer_size 128k;
proxy_send_timeout ;
proxy_read_timeout ;
proxy_buffer_size 4k;
proxy_buffers 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_pass http://localhost:81;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
error_page /50x.html;
location = /50x.html {
root html;
}
}
server{
listen 80;
server_name s.smk5s.cn;
location / {
root /data/mmall/mmall/;
expires 7d;
add_header Access-Control-Allow-Origin *;
}
}
server{
listen 80;
server_name adminsmk.wefallin.cn;
location / {
root /data/mmall/mmall/backend/dist;
index index.html;
}
}
}
centos 6.6编译安装nginx的更多相关文章
- Centos 6.5编译安装Nginx+php+Mysql
说明: 操作系统:CentOS 6.5 64位 准备篇: 一.配置好IP.DNS .网关,确保使用远程连接工具能够连接服务器 二.配置防火墙,开启80端口.3306端口 vi /etc/sysconf ...
- centos 6.3 编译安装 nginx +mysql + php
这篇文章是对另一篇文章的整理,作为记录收藏 1,配置防火墙,开启80端口.3306端口 配置iptables,开启80端口.3306端口 vi /etc/sysconfig/iptables -A I ...
- centos 6 下编译安装 nginx
下载nginx源码包,可以到nginx官方的下载文件归档里 http://nginx.org/download/ 下载 下载pcre源码,并编译安装,从pcre官方下载 ftp://ftp.csx. ...
- 在CentOS 7下编译安装Nginx+PHP+MySQL环境
本文转载自:http://www.softeng.cn/?p=156,本文已获得作者授权,未经作者同意,不可转载. 1.前言 本文适合于已经对Linux操作系统具有基本操作经验,并且能够在Linux或 ...
- Centos 6.3 编译安装Nginx+php+Mysql
1.配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables 将 -A INPUT -m state --state NEW -m tcp -p tcp --dpo ...
- centos源码编译安装nginx过程记录
前言:Centos系统编译安装LNMP环境是每来一台新服务器或换电脑都需要做的事情.这里仅做一个记录.给初学者一个参考! 一.安装前的环境 这里用的是centos 7系统. 我们默认把下载的软件放在 ...
- Centos 7下编译安装Nginx
一.下载源代码 百度云网盘下载地址:https://pan.baidu.com/s/19MQODvofRNnLV9hdAT-R6w 提取码:zi0u 二.安装依赖及插件 yum -y install ...
- CentOS 6.7 编译安装Nginx 1.8.0
1.配置编译环境 yum update && yum upgrade yum groupinstall "Development Tools" 或者 yum ins ...
- CentOS源码编译安装Nginx
安装编译用到的软件: yum install glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel 现在到http://nginx.o ...
随机推荐
- UGUI之不规则按钮的响应区域
比如一些不规则按钮最好可以设置它的响应区域.如下图所示,用Polygon Collider2D组件圈出精灵响应事件的区域. 注意 IsRaycastLocationValid 的判断区域是RectTr ...
- django 配置中STATICFILES_DIRS 和STATIC_ROOT不能同时出现
系统环境: win7 django版本查看: 启动django项目的时候,一直找不到静态资源,很奇怪放在linux服务器上的时候好好的,拿下来随便修改了配置就说url找不到了. 用wingIDE没有任 ...
- 企业IT管理说:全自动就一定是最好的吗?
现如今,企业基础设施变得越来越网络化.虚拟化并且愈加复杂,人们更愿意寻求自动化以期优化信息管理过程.毕竟,有谁不想要一个更为有效且迅速的法子来管控数据的安全.存储.应用性能监控以及IT的经济性?这不用 ...
- jquery ajax 请求中 中文汉字的 转码问题
1.汉字参数直接跟在请求连接的后面,这样需要使用encodeURIComponent(fileName)或者encodeURI(fileName)转码两次 后台使用URLDecoder.decode( ...
- 为什么React事件处理函数必须使用Function.bind()绑定this?
最近在React官网学习Handling Events这一章时,有一处不是很明白.代码如下: class Toggle extends React.Component { constructor(pr ...
- 微信公众号支付-Common
using System.Web; /// <summary> /// 公共帮助类 /// </summary> public class Common { private H ...
- ajax访问WebService跨域问题
1.先看一个网站介绍,了解跨域问题 HTTP访问控制(CORS) 2.像谷歌.火狐浏览器对一些非简单请求会触发预检请求,首先使用 OPTIONS 方法发起一个预检请求到服务器,然而IE浏览器 ...
- Create maintenance backup plan in SQL Server 2008 R2 using the wizard
You will need to identify how you want your maintenance plan to be setup. In this example the mainte ...
- HttpClient(四)-- 使用代理IP 和 超时设置
1.代理IP的用处: 在爬取网页的时候,有的目标站点有反爬虫机制,对于频繁访问站点以及规则性访问站点的行为,会采集屏蔽IP措施.这时候,就可以使用代理IP,屏蔽一个就换一个IP. 2.代理IP分类: ...
- Splash images_enabled 属性
images_enabled属性用于设置加载页面时是否加载图片,如下,禁止之后,返回的页面截图就不会带有任何图片,加载速度也会快很多 function main(splash, args) splas ...