Nginx

新伺服器上的joomla空白頁

  • June 14, 2019

我將 joomla web 文件夾從 ubuntu 14.04 複製到同一目錄到 ubuntu 16.04 伺服器。

所有設置不變。

在確保 vhost fastcgi 指向 php7.0-fpm.sock 而不是 ubuntu 16.04 上的 php5.-fpm.sock 後,它只顯示空白螢幕。

在訪問日誌上:

192.168.1.10 - - [19/Jul/2016:11:09:45 +0800] "GET / HTTP/1.1" 500 5 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0"

/etc/nginx/nginx.conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
       worker_connections 100;
       multi_accept on;
       use epoll;
}
http {
       client_max_body_size 200M;
       sendfile on;
       tcp_nopush on;
       tcp_nodelay on;
       keepalive_timeout 65;
       keepalive_requests 200;
       types_hash_max_size 2048;
       server_names_hash_max_size 1024;
       server_names_hash_bucket_size 128;
       server_tokens off;
       include /etc/nginx/mime.types;
       default_type application/octet-stream;
       access_log off;
       error_log /var/log/nginx/error.log;
       open_file_cache max=600000 inactive=20s;
       open_file_cache_valid 60s;
       open_file_cache_min_uses 2;
       open_file_cache_errors on;
       gzip on;
       gzip_vary on;
       gzip_min_length 256;
       gzip_comp_level 3;
       gzip_proxied expired no-cache no-store private auth;
       gzip_types text/css text/xml text/javascript application/x-javascript application/xml;
       gzip_disable "MSIE [1-6]\.";
       include /etc/nginx/conf.d/*.conf;
       include /etc/nginx/sites-enabled/*;
       fastcgi_buffer_size 128k;
       fastcgi_buffers 256 16k;
       fastcgi_busy_buffers_size 256k;
       fastcgi_temp_file_write_size 256k;
       fastcgi_connect_timeout 30;
       fastcgi_send_timeout 25;
       fastcgi_read_timeout 20;
}

/etc/nginx/sites-enabled/mydomain

server {
       listen 80;
       root /var/www/;
       index index.php index.html index.htm;
       server_name www.mydomain.com;
       location / {
               try_files $uri $uri/ /index.php?q=$request_uri;
       }
       location ~ \.php$ {
               fastcgi_split_path_info ^(.+\.php)(/.+)$;
               fastcgi_pass unix:/run/php/php7.0-fpm.sock;
               fastcgi_index index.php;
               include fastcgi_params;
               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       }
}

以前(ubuntu 14,04, php5, nginx 1.4),是因為不包括fastcgi_index,包括fastcgi_params,這次不包括(ubuntu 16.04, php7, nginx 1.10)。即使刪除這些設置也不能解決這個問題。

可能與 PHP 7 不兼容。您可以按照本指南從系統中清除 PHP 7 並安裝 PHP 5.6。這可能會解決您的問題,但我認為 Joomla 3.5 支持 PHP 7。您是否使用不支持 PHP 7 的舊版 Joomla?您可以同時嘗試一下,看看它是否能解決您的問題,或者下載最新版本的 Joomla。

在 Xenial (16.04) 上安裝 PHP 5.6

引用自:https://serverfault.com/questions/790832