作者:叮2011_923 | 来源:互联网 | 2014-05-28 09:40
makeinstall安装完成之后安装nginx./configure--with-http_stub_status_module?prefix/usr/local/nginxmakemakeinstall就这样nginx安装完成启动nginx命令如下./nginx如果通过http://localhost能够访问的话表
make install
安装完成之后 安装
nginx
./configure --with-http_stub_status_module
?prefix=/usr/local/nginx
make
make install
就这样nginx 安装完成 启动nginx 命令如下 ./nginx & 如果通过http://localhost
能够访问的话 表示安装成功 /如图:
安装成功后 /usr/local/nginx 目录下有四个子目录分别是:conf、html、logs、sbin 。其中 Nginx
的配置文件存放于 conf/nginx.conf,Nginx 只有一个程序文件位于 sbin 目录下的 nginx 文件。
打开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 {
use epoll;#linux
worker_connections
2048;
}
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;
sendfile
on;
#tcp_nopush on;
#keepalive_timeout
0;
keepalive_timeout
65;
#gzip on;
upstream mao{
server 192.168.0.208:8080 weight=2;
server 192.168.0.235 weight=3;
}
server {
listen
80;
server_name www.today.com;
charset utf-8;
#access_log logs/host.access.log main;
location ~*
^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)
{
access_log off; # po co mi logi
obrazków :)
expires
30d;
}
location ~
^/(WEB-INF)/ {
deny all;
}
location /NginxStatus/ {
stub_status on; #Nginx 状态监控配置
access_log off;
}
location /they{
proxy_pass http://mao;# 反向代理
#include proxy.conf;