手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Ubuntu Server 10.04+Nginx+MySQL+PHP+Zend网站架设

[日期:2010-05-29] 来源:Ubuntu社区  作者:by0x0021 [字体:大 中 小]

9、 配置nginx

代码:
sudo vi /etc/nginx/nginx.conf

具体配置网上可以搜到,我的 配置:

代码:
user www-data;
worker_processes 2;
error_log /dev/null crit;
pid /var/run/nginx.pid;
events {
worker_connections 3000;
}
http {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 8k;
gzip_http_version 1.1;
gzip_comp_level 3;
gzip_types text/css text/xml text/plain application/x-Javascript application/xml application/pdf application/x-perl application/x-tcl application/msword application/rtf application/vnd.ms-excel application/vnd.ms-powerpoint application/vnd.wap.xhtml+xml image/x-ms-bmp;
gzip_disable "MSIE [1-6] \.";
gzip_vary on;
output_buffers 4 32k;
client_max_body_size 20m;
server {
listen 80;
server_name localhost;
charset utf-8,gb2312;
access_log /home/Ubuntu/log/access.log;
location / {
root /home/ubuntu/www;
index index.html index.htm index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
set $path_info "/";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
root /home/ubuntu/www;
access_log off;
expires 30d;
}
location ~ .*\.(js|css|ico)?$ {
root /home/ubuntu/www;
access_log off;
expires 1h;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /home/ubuntu/www;
}
fastcgi_param SCRIPT_FILENAME /home/ubuntu/www/$real_script_name;
fastcgi_param script_name $real_script_name;
fastcgi_param path_info $path_info;
include /etc/nginx/fastcgi_params;
}
}

linux
相关资讯       Ubuntu Server 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款