Chinaunix首页 | 论坛 | 博客
  • 博客访问: 658229
  • 博文数量: 87
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2022
  • 用 户 组: 普通用户
  • 注册时间: 2014-04-23 11:16
个人简介

西邮大三狗!!!

文章分类

全部博文(87)

文章存档

2015年(47)

2014年(40)

分类: 架构设计与优化

2014-11-04 21:10:30

到最后一步咯,编译我们的nginx
下载我们的nginx
我使用的是nginx-1.6.2.tar.gz
tar -zxf nginx-1.6.2.tar.gz
vi auto/cc/gcc
#CFLAGS=”$CFLAGS -g” (注释掉这行,去掉 debug 模式编译,编译以后程序只有几百 k)
vi src/core/nginx.h
#define NGINX_VERSION "1.6.2”
#define NGINX_VER "nginx"
(修改此行, 去掉后面的 “ NGINX_VERSION”,为了安全,这样编译后外界无法获取程序的版本号)

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
我们可以cd /usr/local/nginx然后du -sh * 看一下是不是只有几百K?
ln -s /usr/local/nginx/sbin/nginx /usr/sbin (这样我们可以在shell下面控制管理nginx)
vi /usr/local/nginx/conf/nginx.conf 对nginx配置
我的配置简单如下:
user www www;
worker_processes 8;error_log logs/error.log crit;
pid
logs/nginx.pid;
worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 65535;
}
http {
include
mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile
on;
tcp_nopush
on;
keepalive_timeout 65;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers
4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types
text/plain application/x-javascript text/css application/xml;
gzip_vary on;
server {
listen
80;
server_name station25.example.com;
location / {
root html;
index index.php index.html index.htm;
}
location ~ \.php$ {
root
html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include
fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{expires
30d;
}
location ~ .*\.(js|css)?$
{
expires
1h;
}
location /status {
stub_status on;
access_log off;
}
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;
}
}
cd /usr/local/nginx/html
vim index.php

    php.info();
    ?>
保存,然后开启我们的nginx,浏览器访问看下编译所需要的功能是不是都OK了



用下面这几个命令管理nginx
nginx -t    检测语法
nginx       运行 nginx
nginx -s reload     重载主配置文件
nginx -s stop     关闭 nginx
到此我们的lnmp平台编译完毕,不过我还要添加一些功能进去,譬如:Memcache  eaccelerator ImageMagick
还有我们的PHP安全设置,nginx日志分析脚本等...

还可以搭建个论坛折腾一下....嘿嘿
由于肚子时在支撑不住,我还是先去食堂饱餐一顿,明天接着干!!!



阅读(2606) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~