CentOS7 + Nginx + PHP + MySql + project example, environment construction and nginx. after conf is updated, the test page wkb. kquanr. comtest. php can be opened correctly, but the wkb.kquanr.com homepage is always blank in nginx. the service has been configured in conf... centOS 7 + Nginx + PHP + MySql + project example, environment construction and nginx. after the conf file is updated, the testing page is updated.
You have configured the server in nginx. conf and added fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
If the database connection is correct and the relevant database SQL file is correctly imported, the project redirection page still cannot be opened and is displayed blank. If you want to understand this page, please give me some advice. Thank you!
The following is the nginx. conf configuration file.
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; }}
}
Reply content:
CentOS 7 + Nginx + PHP + MySql + project example. After the environment is set up and nginx. conf is updated, the testing page is released.
You have configured the server in nginx. conf and added fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
If the database connection is correct and the relevant database SQL file is correctly imported, the project redirection page still cannot be opened and is displayed blank. If you want to understand this page, please give me some advice. Thank you!
The following is the nginx. conf configuration file.
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