0
点赞
收藏
分享

微信扫一扫

Linux 下 Nginx的安装:(解压,进入目录里面执行,./configure –-> make -> sudo make install)...


参考文献:

 

http://www.2cto.com/os/201201/117129.html l

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

 

 

Nginx 的安装:(解压,进入目录里面执行, ./configure –-> make -> sudo make install

1、   

jdk 和绿色版的 tomcat

 

       1.1、再解压 # tar -zxvf xxxx.tar.gz

--prefix=/web/webserver/nginx
               ./configure  --prefix=/web/webserver/nginx
                make
                make install

1.2 、默认安装在 /usr/local/

1.3 、测试是否安装成功,及驱动 nginx

1.4 、进入, cd /usr/local/nginx/sbin/

1.5 、测试是否编译成功 命令是 ,   ./nginx –t  

 

 

1.6 、启动 nginx 命令: ./nginx

1.7 、关掉 nginx

方法1、# ./nginx -s stop

方法2、擦看进程 #ps -ef|grep nginx    杀死进程   kill -9

 

 

 

 

 



Nginx 实战



用途

1 HTTP 服务器

2 反向代理服务器 代理 Tomcat Apache

Windows 安装

常用命令

nginx 或者 nginx.exe 启动

注意有的网页上说是 nginx start 事实上高版本 nginx 没有这个命令了

 

nginx -s stop 强制关闭

nginx -s quit 安全关闭

nginx -s reload 改变配置文件的时候,重启nginx工作进程,来时配置文件生效

nginx -s reopen 打开日志文件

nginx -h 帮助

日志文件 log 目录

FAQ

2011/10/08 13:34:20 [emerg] 9860#8292: CreateFile() "F:\技术资料\我写的代码示例\Ngnix\Windows\nginx-1.0.8/conf/nginx.conf" failed (1113: No mapping for the Unicode character exists in the target multi-byte code page)

不能有中文路径,否则报错

 2011/10/08 13:43:06 [emerg] 10916#13552: unknown directive "



 

 

2、  通过 nginx 代理 加载项目。配置文件的位置( /usr/local/nginx/conf/nginx.conf

 

worker_processes   1;
 
events {
     worker_connections   1024;
}
 
 
http {
     include        mime.types;
     default_type   application/octet-stream;
 
 
     #access_log   logs/access.log   main;
 
     sendfile         on;
     #tcp_nopush      on;
 
     #keepalive_timeout   0;
     keepalive_timeout   65;
 
 
upstream console.g12e.org{
             ip_hash;
             server 192.168.190.17:8090;
     }
#   server 192.168.190.17:8090; 中的 8090  是 tomcat
     server {
         listen        80;
         server_name   localhost;
 
 
         location / {
             root    html;
             index   index.html index.htm;
         }
 
         error_page    500 502 503 504   /50x.html;
         location = /50x.html {
             root    html;
         }
     }
 
 
#console.g12e.org
        server{
         listen 80;
               server_name console.g12e.org;
         charset utf-8;
         location / {
                 proxy_pass   http://console.g12e.org;
                 proxy_buffer_size 64k;
                 proxy_buffers 4 64k;
                 proxy_redirect     off;
                 proxy_set_header   Host $host;
                 proxy_set_header   X-Real-IP   $remote_addr;
                 proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
         }
        
        error_log logs/error.console.g12e.org.log;
     }
 
}

 

 

Ip: 输出服务器的 ip 地址即可访问 nginx 是否启动成功,它的默认端口是 80

 

参考文献:

 

http://www.2cto.com/os/201201/117129.html

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

举报

相关推荐

0 条评论