Nginx_conf

Posted lyshark

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Nginx_conf相关的知识,希望对你有一定的参考价值。

#user nobody; #设置用户与组
worker_processes 1; #启动子进程数

#error_log logs/error.log; #错误日志及日志级别
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid; #保存进程号的文件


events {
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; #访问日志采用main定义格式

sendfile on; #是否调用sendfile进行内存复制
#tcp_nopush on; #产生一个响应头信息包

#keepalive_timeout 0; #保持连接超时时间
keepalive_timeout 65;

#gzip on; #是否采用压缩

server { #使用server定义虚拟主机
listen 80;
server_name localhost;

#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 #下三行表示,若用户访问以php结尾的
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1; #自动转给http://****它执行
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache‘s document root
# concurs with nginx‘s one
#
#location ~ /\.ht { #拒绝所有人访问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 { #开启ssl加密
# listen 443;
# server_name localhost;

# ssl on;
# ssl_certificate cert.pem; #指定私钥文件
# ssl_certificate_key cert.key;

# ssl_session_timeout 5m;

# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}

































































以上是关于Nginx_conf的主要内容,如果未能解决你的问题,请参考以下文章