- 积分
- 48
- 威望
-
- 金钱
-
- 注册时间
- 2010-5-25
- 在线时间
- 小时
- 最后登录
- 1970-1-1
|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2010-5-25 23:51:11
|
显示全部楼层
谢谢军哥,我可以直接把NGINX.CONF 文件内容复制到VHOST.CONF中后, 以后就在VHOST.CONF中修改吧( 目前我发现VHOST.CONF 和NINGX.CONF初始化内容不一样,明显的NGINX.CONF的要丰富些),这是第一个问题.代码如下
-
- 以下为VHOST.CONF
-
- server
- {
- listen 80;
- server_name www.baowang.com;
- index index.html index.htm index.php default.html default.htm default.php;
- root .home/wwwroot/www;
- include other.conf;
- location ~ .*\.(php|php5)?$
- {
- fastcgi_pass unix:/tmp/php-cgi.sock;
- fastcgi_index index.php;
- include fcgi.conf;
- }
- location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
- {
- expires 30d;
- }
- location ~ .*\.(js|css)?$
- {
- expires 12h;
- }
- log_format www.baowang.com '$remote_addr - $remote_user [$time_local] $request '
- '$status $body_bytes_sent $http_referer '
- '$http_user_agent $http_x_forwarded_for';
- access_log www.baowang.com.log www.baowang.com;
- }
复制代码- 以下为NGINX.CONF代码
- user www www;
- worker_processes 1;
- error_log /home/wwwroot/logs/nginx_error.log crit;
- pid /usr/local/nginx/logs/nginx.pid;
- #Specifies the value for maximum file descriptors that can be opened by this process.
- worker_rlimit_nofile 51200;
- events
- {
- use epoll;
- worker_connections 51200;
- }
- 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 60;
- 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 256k;
- 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;
- #limit_zone crawler $binary_remote_addr 10m;
- server
- {
- listen 80;
- server_name baowang.com;
- index index.html index.htm index.php;
- root /home/wwwroot/www;
- location ~ .*\.(php|php5)?$
- {
- fastcgi_pass unix:/tmp/php-cgi.sock;
- fastcgi_index index.php;
- include fcgi.conf;
- }
- location /status {
- stub_status on;
- access_log off;
- }
- location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
- {
- expires 30d;
- }
- location ~ .*\.(js|css)?$
- {
- expires 12h;
- }
- log_format access '$remote_addr - $remote_user [$time_local] "$request" '
- '$status $body_bytes_sent "$http_referer" '
- '"$http_user_agent" $http_x_forwarded_for';
- access_log /home/wwwroot/logs/access.log access;
- }
- include vhost/*.conf;
- }
复制代码 我同时参考了张宴的博客: http://blog.s135.com/nginx_php_v6/
准备下面参考张宴文章优化:
1.优化LINUX内核, 并手动创立子目录(对应子域名)在wwwroot下,记得参考张宴文章修改文件属性.
2.修改NINGX 平滑改动配置(是否LNMP已经默认配置好)
3.另外修改最大连接为128(max_children">128),因为我内存超过3G
PHP-FPM中的 Sets the limit on the number of simultaneous requests that will be served.
Equivalent to Apache MaxClients directive.
Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
Used with any pm_style.
<value name="max_children">128</value>
以上请参考张宴博客对应部分进行优化.
此外:
IAMP的模块, 避免论坛无法发邮件,请问如何解决?
如何升级NGINX到0.8.36 (可选项目,未来考虑)
等待你的回复,谢谢.
[ 本帖最后由 spectrum 于 2010-5-25 23:55 编辑 ] |
|