一个简单可用的nginx.conf配置
2017-08-02 16:03
465 查看
user www;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
error_log /usr/local/nginx/logs/info.log info;
pid /usr/local/nginx/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
root /usr/local/www;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
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;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
#root /usr/local/www;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/usr/local/php/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
error_log /usr/local/nginx/logs/info.log info;
pid /usr/local/nginx/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
root /usr/local/www;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
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;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
#root /usr/local/www;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/usr/local/php/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
相关文章推荐
- nginx 简单的配置(nginx.conf)
- Nginx之二:nginx.conf简单配置(参数详解)
- nginx学习3——用nginx配置一个简单站点
- Heartbeat+Haresources+NFS配置一个简单的HA高可用+资源共享集群
- 最简单的配置nginx.conf使之成为静态文件下载服务器
- LVS+Keepalived+Nginx+Tomcat高可用负载均衡集群配置(DR模式,一个VIP,多个端口)
- Nginx配置一个简单的虚拟主机
- nginx.conf简单配置
- Nginx-配置一个简单的http虚拟服务
- 自我复习之nginx+keepalived实现高可用(主要是配置,自我简单记录)
- 一个简单的nginx加多个fastcgi的负载均衡配置过程
- 一个简单实际可用的CAS配置日志
- Nginx 手记(二)配置语法、nginx.conf 简单讲解
- nginx.conf配置文件的简单说明
- Nginx服务器安装详情及配置:反向代理+动静分离+负载均衡+keepalived实现高可用
- Nginx 源码分析-- 模块module 解析执行 nginx.conf 配置文件流程分析 二
- nginx.conf 配置文件中文说明
- nginx.conf 文中描述的配置文件
- 智能一代云平台(十七):Keepalived+Nginx实现高可用,反向代理---Keepalived安装及相关配置
- nginx.conf 集群完整配置