一、 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;
include /usr/local/nginx/sites-enabled/*;
#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;
#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 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 {
# 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;
# 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;
# }
#}
}
二: sites-available/www.myblog.com
upstream unicorn_server {
server unix:/home/dong/workspace/blog/tmp/nginx/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.myblog.com;
root /home/dong/workspace/blog/public;
#charset koi8-r;
client_max_body_size 50M;
#access_log logs/host.access.log main;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering on;
proxy_pass http://unicorn_server;
}
}
分享到:
相关推荐
一个NGINX conf 配置文件中的变量大全
Notepad++ 自定义 nginx.conf 文件语法高亮的配置文件 使用教程:点击语言-自定义语言格式-导入(下载的xml文件)-重启notepad++,即可使用
nginx conf配置方便使用
nginx.conf配置文件,反向代理,负载均衡--轮询、权重、IPHASH等
nginx方式解决跨域请求,配置文件中将前端和后端反向代理到nginx服务器,使得前后端遵循同源策略,就不会有跨域请求的问题了
nginxconf web页面自由配置nginx虚拟主机 该项目基于golang的 beego web框架 主要实现了一下功能 创建新的nginx代理配置文件 并自动调用 nginx reload 命令 暂时没有实现删除配置文件命令 #应用场景 nginx需要实现...
Linux下的Nginx配置文件 修改IP端口即可使用
这是我《记录RTSP通过FFmpeg+nginx发布成rtmp和http-flv》中附带的代码和工具,包括rtmp推流的FFmpeg命令、rtmp推流的demo源码(使用FFmpegAPI)、nginx的配置conf、flv.js等。
nginx1.21.5 nginx.conf配置文件
本资源是专门针对本博文的, nginx的反向代理的简单配置文件,给大家使用时做参考,拿走不谢,怎么一定要50字呢?
nginx.conf例子 多域名配置例子
在配置 nginx.conf 总会遇到一些问题,下面列举一些常见的问题并说明如何解决 1、相对路径的问题 例如配置文件中 location 设置 location ~ .php${ root html } location 中root所指向的html是一个相对路径,...
通用的nginx conf生成器,用于促进nginx的REST服务。 该项目严重依赖sql解析器来生成表的配置文件。 这个项目的灵感来自,以及 。 依存关系 Nginx的 PostgreSQL 开放式 sqlparse> = 0.2.0(python) 苹果电脑 ...
nginx的各项详细配置-超多注释-里面有配置文件和一个txt的说明文件
nginx.conf配置文件下载
Nginx日志描述 通过访问日志,你可以得到用户地域来源、跳转来源、使用终端、某个URL访问量等相关信息;通过错误日志,你可以得到系统某个服务或server的性能瓶颈等。因此,将日志好好利用,你可以得到很多有价值的...
Nginx配置文件 nginx.conf 详解doc文档
弃用:Nginx Autoconf(适用于... nginx-autoconf服务会挂载/var/run/docker.sock文件,以便它可以侦听/etc/nginx/conf.d事件以及nginx的/etc/nginx/conf.d目录。 最后要做的是添加应用程序服务,并向其中添加app.vir
nginx nginx.conf配置文件,下载后请根据自己的实际环境做相应的修改