您的位置:首页 > 运维架构 > Nginx

nginx---Beginner's Guide

2016-04-13 17:10 681 查看

一 启动


nginx -s signal


Where signal may be one of the following:

stop
— fast shutdown

quit
— graceful shutdown

reload
— reloading the configuration file

reopen
— reopening the log files

nginx -c nginx.conf  指定配置文件

二 配置文件

块关系

  main    *events

         *http       **server    ***location     

      

三 目录设置

设置文件根目录


location / {
root /data/www;
}


四 简单代理设置

设置1


server {
  代理服务器IP+PORT设置
location / {
proxy_pass http://localhost:8080/; }

所有 .(gif|jpg|png) 文件均访问本服务器,其他文件访问代理服务器
~ 表示后面为正则表达式
location ~ \.(gif|jpg|png)$ {
root /data/images;
}
}


设置2


server {
  所有.html文件都访问代理服务器
location ~ *.html$ {
proxy_pass http://localhost:8080/; }
}


五 FastCGI代理设置


所有.cgi请求都访问FastCGI代理
location ~ *.cgi$ {
  设置FastCGI代理IP+PORT
fastcgi_pass  localhost:9000;
  设置默认.cgi
fastcgi_index index.cgi;
  包含fastcgi.conf中的所有fastcgi_param
include fastcgi.conf
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: