当前位置:Gxlcms > PHP教程 > linux-CentOS7+Nginx+PHP+MySql+项目例子,测试页面能正确打开,主页面打开一直显示空白

linux-CentOS7+Nginx+PHP+MySql+项目例子,测试页面能正确打开,主页面打开一直显示空白

时间:2021-07-01 10:21:17 帮助过:29人阅读

CentOS 7 + Nginx + PHP + MySql + 项目例子,环境搭建及nginx.conf更新后,测试页面http://wkb.kquanr.com/test.php能正确打开,但http://wkb.kquanr.com主页面打开一直显示空白
在nginx.conf里面已经配置好服务器,已经添加fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
数据库连接正确,且正确导入相关数据库sql文件,项目重定向页面还是打不开,一直显示空白,希望懂这块的朋友可以帮忙指点一下,谢谢啦
以下是nginx.conf配置文件

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {

worker_connections 1024;

}

http {

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';
client_max_body_size 1024M;
access_log  /var/log/nginx/access.log  main;

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   65;
types_hash_max_size 2048;

include             /etc/nginx/mime.types;
default_type        application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;

server {
    listen       80;
    server_name  wkb.kquanr.com  www.wkb.kquanr.com;
    root         /var/www/weikeba/web;
    access_log   /var/log/nginx/weikeba.access.log;
    error_log   /var/log/nginx/weikeba.error.log;

    location / {
        index app.php;
        try_files $uri @rewriteapp;
    }

    location @rewriteapp {
        rewrite ^(.*)$ /app.php/$1 last;
    }

    location ~ ^/udisk {
        internal;
        root /var/www/weikeba/app/data/;
    }
    location ~ ^/(app|app_dev)\.php(/|$) {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param  HTTPS              off;
    fastcgi_param HTTP_X-Sendfile-Type X-Accel-Redirect;
    fastcgi_param HTTP_X-Accel-Mapping /udisk=/var/www/weikeba/app/data/udisk;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 8 128k;
    }
    location ~* \.(jpg|jpeg|gif|png|ico|swf)$ {
    expires 3y;
    access_log off;
    gzip off;
    }
    location ~* \.(css|js)$ {
    access_log off;
    expires 3y;
    }
    location ~ ^/files/.*\.(php|php5)$ {
    deny all;
    }
    location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param  HTTPS              off;
    }
}

}

回复内容:

CentOS 7 + Nginx + PHP + MySql + 项目例子,环境搭建及nginx.conf更新后,测试页面http://wkb.kquanr.com/test.php能正确打开,但http://wkb.kquanr.com主页面打开一直显示空白
在nginx.conf里面已经配置好服务器,已经添加fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
数据库连接正确,且正确导入相关数据库sql文件,项目重定向页面还是打不开,一直显示空白,希望懂这块的朋友可以帮忙指点一下,谢谢啦
以下是nginx.conf配置文件

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {

worker_connections 1024;

}

http {

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';
client_max_body_size 1024M;
access_log  /var/log/nginx/access.log  main;

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   65;
types_hash_max_size 2048;

include             /etc/nginx/mime.types;
default_type        application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;

server {
    listen       80;
    server_name  wkb.kquanr.com  www.wkb.kquanr.com;
    root         /var/www/weikeba/web;
    access_log   /var/log/nginx/weikeba.access.log;
    error_log   /var/log/nginx/weikeba.error.log;

    location / {
        index app.php;
        try_files $uri @rewriteapp;
    }

    location @rewriteapp {
        rewrite ^(.*)$ /app.php/$1 last;
    }

    location ~ ^/udisk {
        internal;
        root /var/www/weikeba/app/data/;
    }
    location ~ ^/(app|app_dev)\.php(/|$) {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param  HTTPS              off;
    fastcgi_param HTTP_X-Sendfile-Type X-Accel-Redirect;
    fastcgi_param HTTP_X-Accel-Mapping /udisk=/var/www/weikeba/app/data/udisk;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 8 128k;
    }
    location ~* \.(jpg|jpeg|gif|png|ico|swf)$ {
    expires 3y;
    access_log off;
    gzip off;
    }
    location ~* \.(css|js)$ {
    access_log off;
    expires 3y;
    }
    location ~ ^/files/.*\.(php|php5)$ {
    deny all;
    }
    location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    include fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param  HTTPS              off;
    }
}

}

nginx.conf贴上来

人气教程排行