首页新闻找找看学习计划

linux(ubuntu)PHP 项目虚拟机配置问题(已纠结很久)。

0
[已解决问题] 解决于 2015-06-26 09:59

系统版本:ubuntu 最新版
软件信息: PHP mysql nginx 是用ezhttp装的(命令)
目前状况:能访问localhost 以及nginx工作目录下的文件。数据库正常。
异常 : 虚拟机配置异常。
虚拟机配置方式:sudo ez vhost add 配置 启用了url重写。
配置虚拟机的详细内容:
定义的重写规则:
if (!-e $request_filename) {
rewrite ^/(.*) /index.php/$1 last;
}
该重写文件路径为/usr/local/nginx/conf/rewrite/doitphp.conf
通过虚拟机配置命令自动生成的虚拟机配置文件:
server {
server_name http://www.admin.com;
listen 80;
index index.php index.html index.htm;
root /home/wwwroot/jkpt/admin/public;
include rewrite/doitphp.conf;
location ~ \.php($|/){
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_param PHP_VALUE open_basedir=$document_root:/tmp/:/proc/;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}

location ~ .*\.(js|css)?$ {
expires 12h;
}

access_log /home/wwwlog/http://www.admin.com/access.log access;
error_log /home/wwwlog/http://www.admin.com/error.log error;
}


nginx 配置文件
error_log logs/error.log error ;
pid logs/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 51200;

events {
use epoll;
worker_connections 51200;
}


http {
client_body_buffer_size 32k;
client_header_buffer_size 2k;
client_max_body_size 2m;
default_type application/octet-stream;
log_not_found off;
server_tokens off;
include mime.types;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/rss+xml application/xhtml+xml application/atom_xml;
gzip_vary on;
#error_page 500 502 503 504 /50x.html;
log_format access *$remote_addr - $remote_user [$time_local] "$request" *
*$status $body_bytes_sent "$http_referer" *
*"$http_user_agent" $http_x_forwarded_for*;

server {
listen 80 default_server;
server_name localhost;
root /home/wwwroot;
index index.php index.html index.htm;

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_VALUE open_basedir=$document_root:/tmp/:/proc/;
include fastcgi_params;
}

}

include vhost/*.conf;
}


hosts 配置
127.0.0.1 localhost
127.0.1.1 chen-Lenovo-B490
127.0.0.1 http://www.test.com
127.0.0.1 http://www.admin.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
另外:phpinfo() 发现 virtual directory support : disable
以上的http://www.test.com 是配置的测试虚拟机,能够访问HTML文件,但是,PHP文件不会进行编译运行,浏览器被告之直接下载这个文件,哪位有空请帮忙指点下。
谢谢。
QQ 525945448

鱼尾纹的主页 鱼尾纹 | 初学一级 | 园豆:195
提问于:2014-10-07 20:13
< >
分享
最佳答案
0

已经搞定。我把重写规则去掉,直接夹在vhost配置文件中的server里面就正常了。

鱼尾纹 | 初学一级 |园豆:195 | 2014-10-08 21:07
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册