Nginx简单安装配置(V1.7.8)
2014-12-18 19:54
288 查看
#安装pcre-devel进行http-rewrite,安装zlib开启http-gzip压缩功能;
yum install pcre-devel zlib-devel
make && make install
如果需要开启nginx状态在进行configure时加入
--with-http_stub_status_module
并在相应的server下加入相应的location,例如
location /nginx_status
{
stub_status on;
access_log off;
allow 192.168.0.0/16;
deny all;
}
完整配置文件如下(以三台服务器nginx反向代理为例):
worker_processes 16;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
upstream datapub_platform
{
server 10.0.96.1;
server 10.0.96.2;
server 10.0.96.3;
}
server {
listen 8841;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://datapub_platform;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /nginx_status
{
stub_status on;
access_log off;
allow 192.168.0.0/16;
deny all;
}
# index index.html index.htm;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
yum install pcre-devel zlib-devel
make && make install
如果需要开启nginx状态在进行configure时加入
--with-http_stub_status_module
并在相应的server下加入相应的location,例如
location /nginx_status
{
stub_status on;
access_log off;
allow 192.168.0.0/16;
deny all;
}
完整配置文件如下(以三台服务器nginx反向代理为例):
worker_processes 16;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
upstream datapub_platform
{
server 10.0.96.1;
server 10.0.96.2;
server 10.0.96.3;
}
server {
listen 8841;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://datapub_platform;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /nginx_status
{
stub_status on;
access_log off;
allow 192.168.0.0/16;
deny all;
}
# index index.html index.htm;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
相关文章推荐
- Nginx使用:Ubuntu安装与简单配置
- Nginx安装以及简单配置
- Nginx安装与配置文件解析 【简单描述】
- centos 7.3 安装 nginx 及简单配置
- ECS centos6.8系统下从nginx安装到简单网站上线配置操作的完整记录
- liunx系统安装nginx,以及配置、用到的简单指令
- Linux 下Nginx 的安装及负载均衡的简单配置
- linux系统上nginx安装及简单的反向代理配置
- linux下安装nginx并简单配置,利用tomcat-redis共享session
- nginx在centos6.5下的安装和反向代理简单配置
- Nginx+Mysql+PHP安装和配置,简单优化
- Centos6.5安装及简单配置nginx
- nginx安装及配置为简单的文件服务器
- Centos6.5编译安装Nginx-1.11.5和简单配置
- 编译安装nginx及简单优化配置
- nginx的安装及简单负载均衡配置
- Nginx简单介绍以及安装与配置
- Linux 下Nginx 的安装及负载均衡的简单配置
- nginx的安装与简单配置
- nginx tar.gz安装方法+简单静态文件配置