常见问题常见问题   搜索搜索   会员列表会员列表   团队团队   注册注册    个人资料个人资料   登录查看您的站内信件登录查看您的站内信件   登录登录 

freebsd 7.0 配置nginx求助

 
发表新文章   回复文章    FreeBSD China -> 技术交流
阅读上一个主题 :: 阅读下一个主题  
作者 留言
jdzcn
半仙


注册时间: 2007-12-17
文章: 48

文章发表于: Thu 2008-07-24 22:56:25    发表主题: freebsd 7.0 配置nginx求助 引用并回复

按照说明配置后。
请求php文件直接就把文件下载回来了。
请求帮助
nginx.conf

#user www;
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 {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;
#default_type application/x-httpd-php;
#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;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 81;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root /usr/local/www/nginx;
index index.html index.htm index.php;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~\.php$ {
root /usr/local/eee/nginx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/nginx$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443;
# server_name localhost;

# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_timeout 5m;

# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}
php.中的cgi-fix-pathinfo 也设置为1了
另外台服务器配置后请求php显示No input file specified.
返回页首
阅览会员资料 发送站内信件
scyzxp
道童


注册时间: 2005-04-12
文章: 326

文章发表于: Thu 2008-07-24 23:48:23    发表主题: Re: freebsd 7.0 配置nginx求助 引用并回复

jdzcn 写到:
按照说明配置后。
请求php文件直接就把文件下载回来了。
请求帮助
nginx.conf

#user www;
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 {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;
#default_type application/x-httpd-php;
#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;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 81;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root /usr/local/www/nginx;
index index.html index.htm index.php;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~\.php$ {
root /usr/local/eee/nginx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/nginx$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443;
# server_name localhost;

# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_timeout 5m;

# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}
php.中的cgi-fix-pathinfo 也设置为1了
另外台服务器配置后请求php显示No input file specified.


多看看nginx.net这个网站吧.

_________________
-------------------------------
开源邮件技术社区
Tmail for FreeBSD技术支持社区
http://www.thismail.org
-------------------------------
返回页首
阅览会员资料 发送站内信件 MSN Messenger
jdzcn
半仙


注册时间: 2007-12-17
文章: 48

文章发表于: Fri 2008-07-25 00:25:18    发表主题: 引用并回复

看过了。按照配置说明做的还是不行。不知道什么原因
返回页首
阅览会员资料 发送站内信件
scyzxp
道童


注册时间: 2005-04-12
文章: 326

文章发表于: Fri 2008-07-25 11:12:59    发表主题: 引用并回复

jdzcn 写到:
看过了。按照配置说明做的还是不行。不知道什么原因


仔细看好不好,你仔细看了,我明天下午给我回复配置文件

_________________
-------------------------------
开源邮件技术社区
Tmail for FreeBSD技术支持社区
http://www.thismail.org
-------------------------------
返回页首
阅览会员资料 发送站内信件 MSN Messenger
kenbaby
道童


注册时间: 2005-03-19
文章: 317

文章发表于: Fri 2008-07-25 11:49:02    发表主题: 引用并回复

为什么这些人总是喜欢跟风呢?

设两个root干什么?
设两个index干什么?

你根本就没仔细看过nginx.net上面的官方文档,建议重新阅读文档一百遍。

_________________
是男人就用8.0-CURRENT!
返回页首
阅览会员资料 发送站内信件 浏览发表者的主页
scyzxp
道童


注册时间: 2005-04-12
文章: 326

文章发表于: Fri 2008-07-25 15:52:32    发表主题: 引用并回复

kenbaby 写到:
为什么这些人总是喜欢跟风呢?

设两个root干什么?
设两个index干什么?

你根本就没仔细看过nginx.net上面的官方文档,建议重新阅读文档一百遍。


其实在nginx中是可以这么做的,他的问题不是出在这里。配置两个root也没有冲突。呵呵,要不然建议楼上的去nginx.net上看50遍文档

_________________
-------------------------------
开源邮件技术社区
Tmail for FreeBSD技术支持社区
http://www.thismail.org
-------------------------------
返回页首
阅览会员资料 发送站内信件 MSN Messenger
kenbaby
道童


注册时间: 2005-03-19
文章: 317

文章发表于: Fri 2008-07-25 18:16:29    发表主题: 引用并回复

scyzxp 写到:
kenbaby 写到:
为什么这些人总是喜欢跟风呢?

设两个root干什么?
设两个index干什么?

你根本就没仔细看过nginx.net上面的官方文档,建议重新阅读文档一百遍。


其实在nginx中是可以这么做的,他的问题不是出在这里。配置两个root也没有冲突。呵呵,要不然建议楼上的去nginx.net上看50遍文档


我没说不可以这么做啊,你可以在apache里面写一大堆rewrite,也可以一句setenv解决所有问题,我从来没说不可以这么做~

_________________
是男人就用8.0-CURRENT!
返回页首
阅览会员资料 发送站内信件 浏览发表者的主页
bsdgod
半仙


注册时间: 2007-07-12
文章: 41
来自: 粤

文章发表于: Fri 2008-07-25 20:42:46    发表主题: 引用并回复

既然不喜欢看英文文档 那就照着这个做吧 我懒得在这里贴出来了,

http://hi.baidu.com/t00r/blog/item/90c0b1fae52d161ba9d311c5.html

_________________
返回页首
阅览会员资料 发送站内信件 MSN Messenger
wangbin
老妖


注册时间: 2003-06-20
文章: 1083

文章发表于: Wed 2008-07-30 23:39:02    发表主题: 引用并回复

nginx没有吹嘘的那么好,感觉非常不稳定,请大家慎用!!
_________________
农民的论坛 果农的家园 FreeBSD的机器!
返回页首
阅览会员资料 发送站内信件
scyzxp
道童


注册时间: 2005-04-12
文章: 326

文章发表于: Thu 2008-07-31 09:51:12    发表主题: 引用并回复

wangbin 写到:
nginx没有吹嘘的那么好,感觉非常不稳定,请大家慎用!!


自己的原因,好好找找是不是自己的原因

_________________
-------------------------------
开源邮件技术社区
Tmail for FreeBSD技术支持社区
http://www.thismail.org
-------------------------------
返回页首
阅览会员资料 发送站内信件 MSN Messenger
kenbaby
道童


注册时间: 2005-03-19
文章: 317

文章发表于: Thu 2008-07-31 10:04:31    发表主题: 引用并回复

不好用就不用呗,不勉强,就像有人喜欢php有人喜欢.net有人喜欢java一样
_________________
是男人就用8.0-CURRENT!
返回页首
阅览会员资料 发送站内信件 浏览发表者的主页
jdzcn
半仙


注册时间: 2007-12-17
文章: 48

文章发表于: Fri 2008-08-01 16:14:30    发表主题: 引用并回复

此帖已经结束。
由于配置文件没搞定的缘故。万恶的空格
返回页首
阅览会员资料 发送站内信件
从以前的文章开始显示:   
发表新文章   回复文章    FreeBSD China -> 技术交流 论坛时间为 北京时间
1页/共1

 
转跳到:  
不能发布新主题
不能在这个论坛回复主题
不能在这个论坛编辑自己的文章
不能在这个论坛删除自己的文章
不能在这个论坛发表投票


Powered by phpBB 2022cc © 2003 Opensource Steps; © 2003-2007 The FreeBSD Simplified Chinese Project
Powered by phpBB © 2001, 2005 phpBB Group
The FreeBSD China Project 网站: 中文计划网站 社区网站
The FreeBSD China Project 版权所有 (C) 1999 - 2003 网页设计版权 著作权和商标