nginx配置入门

1.下载pcre 
#wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz 
2.安装pcre-8.33.tar.gz 

Java代码   收藏代码
  1. #tar zxvf pcre-8.33.tar.gz  
  2. #cd pcre-8.33/  
  3. #./configure  
  4. #make && make install  



3.下载nginx 
#wget http://nginx.org/download/nginx-1.5.3.tar.gz 
4.解压 

Java代码   收藏代码
  1. #tar -zxvf nginx-1.5.3.tar.gz  
  2. #cd nginx-1.5.3  
  3. #./configure --prefix=/usr/local/nginx --with-pcre=/root/pcre-8.33/ --with-http_stub_status_module  --with-http_realip_module  
  4. #make  
  5. #make install  



5.选项 
-c </path/to/config> 为 Nginx 指定一个配置文件,来代替缺省的。 
-t 不运行,而仅仅测试配置文件。nginx 将检查配置文件的语法的正确性,并尝试打开配置文件中所引用到的文件。 
-v 显示 nginx 的版本。 
-V 显示 nginx 的版本,编译器版本和配置参数。 

6.中止运行的进程: 

Java代码   收藏代码
  1. #ps aux | egrep '(PID|nginx)'  
  2. USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND  
  3. root      2213  0.0  0.0   6784  2036 ?        Ss   03:01   0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf  
  4. #kill -15 2213  



平滑改变 nginx 配置的选项(请注意,在重载前,要先测试一下配置文件): 

Java代码   收藏代码
  1. #nginx -t -c /etc/nginx/nginx.conf  
  2. 2006/09/16 13:07:10 [info] 15686#0: the configuration file /etc/nginx/nginx.conf syntax is ok  
  3. 2006/09/16 13:07:10 [info] 15686#0: the configuration file /etc/nginx/nginx.conf was tested successfully  
  4. #ps aux | egrep '(PID|nginx)'  
  5. USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND  
  6. root      2213  0.0  0.0   6784  2036 ?        Ss   03:01   0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf  
  7. #kill -HUP 2213  



开启目录文件索引 

Java代码   收藏代码
  1. location ~ /index/ {  
  2.         autoindex on;  
  3.         autoindex_exact_size off;  
  4.         autoindex_localtime on;  
  5.         break;  
  6. }  




squid的安装 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值