| 阅读上一个主题 :: 阅读下一个主题 |
| 作者 |
留言 |
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
------------------------------- |
|
| 返回页首 |
|
 |
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
------------------------------- |
|
| 返回页首 |
|
 |
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
------------------------------- |
|
| 返回页首 |
|
 |
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 来自: 粤
|
|
| 返回页首 |
|
 |
wangbin 老妖
注册时间: 2003-06-20 文章: 1083
|
|
| 返回页首 |
|
 |
scyzxp 道童
注册时间: 2005-04-12 文章: 326
|
发表于: Thu 2008-07-31 09:51:12 发表主题: |
|
|
| wangbin 写到: | | nginx没有吹嘘的那么好,感觉非常不稳定,请大家慎用!! |
自己的原因,好好找找是不是自己的原因 _________________ -------------------------------
开源邮件技术社区
Tmail for FreeBSD技术支持社区
http://www.thismail.org
------------------------------- |
|
| 返回页首 |
|
 |
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 发表主题: |
|
|
此帖已经结束。
由于配置文件没搞定的缘故。万恶的空格 |
|
| 返回页首 |
|
 |
|