Drupal Internal Server Error 500

本文介绍了解决Drupal网站部署后出现InternalServerError500错误的方法,通过修改.htaccess文件实现301重定向,并提供了具体的.htaccess配置示例。

我在本地测试网站完毕后,上传到空间,出现Internal Server Error 500,这样我只有关闭clean url,然后.htaccess才能起作用,才能实现301的跳转。可当我开启clean url,如果你使用的是drupal 默认的.htaccess,那么就找不到页面。下面我简单地重写了下.htaccess,因为我只需要它实现301跳转。

原文出自:http://suyou.info/node/32

  1. <IfModule mod_rewrite.c>
  2. RewriteEngine on
  3. RewriteBase /
  4. RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
  5. RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]
  6. RewriteCond %{REQUEST_FILENAME} !-f
  7. RewriteCond %{REQUEST_FILENAME} !-d
  8. RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
  9. </IfModule>
Debian系统非Docker安装nextcloud,访问时提示:500 Internal Server Error nginx/1.18.0。nginx/error.log内容如下: 2025/06/09 11:45:17 [error] 32990#32990: *3 rewrite or internal redirection cycle while internally redirecting to "/index.php/index.php/csrftoken", client: 192.168.60.200, server: , request: "GET /index.php/csrftoken HTTP/1.1", host: "192.168.60.200" 2025/06/09 12:00:17 [error] 32990#32990: *4 rewrite or internal redirection cycle while internally redirecting to "/index.php/index.php/csrftoken", client: 192.168.60.200, server: , request: "GET /index.php/csrftoken HTTP/1.1", host: "192.168.60.200" 2025/06/09 12:15:20 [error] 32990#32990: *5 rewrite or internal redirection cycle while internally redirecting to "/index.php/index.php/csrftoken", client: 192.168.60.200, server: , request: "GET /index.php/csrftoken HTTP/1.1", host: "192.168.60.200" 2025/06/09 12:30:20 [error] 32990#32990: *6 rewrite or internal redirection cycle while internally redirecting to "/index.php/index.php/csrftoken", client: 192.168.60.200, server: , request: "GET /index.php/csrftoken HTTP/1.1", host: "192.168.60.200" 2025/06/09 12:42:02 [error] 32990#32990: *11 rewrite or internal redirection cycle while internally redirecting to "/index.php/index.php/core/apps/recommended", client: 192.168.60.200, server: , request: "GET /index.php/core/apps/recommended HTTP/1.1", host: "192.168.60.200" 2025/06/09 12:43:10 [error] 32990#32990: *13 rewrite or internal redirection cycle while internally redirecting to "/index.php/index.php/apps/dashboard/", client: 192.168.60.200, server: , request: "GET /index.php/apps/dashboard/ HTTP/1.1", host: "192.168.60.200" 2025/06/09 12:43:23 [error] 32990#32990: *15 rewrite or internal redirection cycle while internally redirecting to "/index.php/index.php/apps/dashboard/", client: 192.168.60.200, server: , request: "GET /index.php/apps/dashboard/ HTTP/1.1", host: "192.168.60.200" 2025/06/09 13:12:22 [error] 38605#38605: *1 rewrite or internal redirection cycle while internally redirecting to "/index.php/index.php/apps/dashboard/", client: 192.168.60.200, server: , request: "GET /index.php/apps/dashboard/ HTTP/1.1", host: "192.168.60.200" 2025/06/09 13:36:09 [error] 38605#38605: *3 rewrite or internal redirection cycle while internally redirecting to "/index.php/index.php/apps/dashboard/", client: 192.168.60.200, server: , request: "GET /index.php/apps/dashboard/ HTTP/1.1", host: "192.168.60.200" 2025/06/09 13:36:16 [error] 38605#38605: *4 rewrite or internal redirection cycle while internally redirecting to "/index.php/index.php/apps/dashboard/", client: 192.168.60.200, server: , request: "GET /index.php/apps/dashboard/ HTTP/1.1", host: "192.168.60.200" 2025/06/09 13:53:56 [error] 38605#38605: *7 rewrite or internal redirection cycle while internally redirecting to "/index.php/index.php/apps/dashboard/", client: 192.168.60.200, server: , request: "GET /index.php/apps/dashboard/ HTTP/1.1", host: "192.168.60.200" 2025/06/09 13:53:56 [error] 38605#38605: *9 open() "/var/www/nextcloud/favicon.ico" failed (2: No such file or directory), client: 192.168.60.200, server: , request: "GET /favicon.ico HTTP/1.1", host: "192.168.60.200", referrer: "http://192.168.60.200/index.php/apps/dashboard/"怎么解决问题?
06-10
## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. # https://www.nginx.com/resources/wiki/start/ # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ # https://wiki.debian.org/Nginx/DirectoryStructure # # In most cases, administrators will remove this file from sites-enabled/ and # leave it as reference inside of sites-available where it will continue to be # updated by the nginx packaging team. # # This file will automatically load configuration files provided by other # applications, such as Drupal or Wordpress. These applications will be made # available underneath a path with that package name, such as /drupal8. # # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. ## # Default server configuration # #server { # listen 80; # listen [::]:80; # server_name jenkins.eftong.cn; # return 301 https://$server_name$request_uri; #} #server { # SSL configuration # # listen [::]:443 ssl ipv6only=on; # managed by Certbot # listen 443 ssl; # managed by Certbot # ssl_certificate /etc/ssl/certs/4177192_jenkins.eftong.cn.pem; # ssl_certificate_key /etc/ssl/certs/4177192_jenkins.eftong.cn.key; # access_log /var/log/nginx/jenkins.access.log; # error_log /var/log/nginx/jenkins.error.log; # listen 443 ssl default_server; # listen [::]:443 ssl default_server; # # Note: You should disable gzip for SSL traffic. # See: https://bugs.debian.org/773332 # # Read up on ssl_ciphers to ensure a secure configuration. # See: https://bugs.debian.org/765782 # # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # # include snippets/snakeoil.conf; # root /var/www/html; # Add index.php to the list if you are using PHP # index index.html index.htm index.nginx-debian.html; # server_name jenkins.eftong.cn; # location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. #try_files $uri $uri/ =404; # include /etc/nginx/proxy_params; # proxy_pass http://localhost:8888; # proxy_read_timeout 90s; # Fix potential "It appears that your reverse proxy setup is broken" error. # proxy_redirect http://localhost:8888 https://jenkins.eftong.cn; # } # pass PHP scripts to FastCGI server # #location ~ \.php$ { # include snippets/fastcgi-php.conf; # # # With php-fpm (or other unix sockets): # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # # With php-cgi (or other tcp sockets): # fastcgi_pass 127.0.0.1:9000; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} #} server { listen 8304; server_name 11.21.1.120; location ^~ /WEB-INF { deny all; } location / { root /home/hcare/support/application/EFT-P9/frontend/client/html; index index.html index.htm; try_files $uri $uri/ /index.html; } location ^~ /auth/ { proxy_set_header Host $host:$server_port; proxy_set_header X-Forwaded-For $remote_addr; proxy_set_header X-Forwaded-Scheme $scheme; proxy_pass http://127.0.0.1:8302; } location ^~ /operator/ { proxy_set_header Host $host:$server_port; proxy_set_header X-Forwaded-For $remote_addr; proxy_set_header X-Forwaded-Scheme $scheme; proxy_pass http://127.0.0.1:8302; } location ^~ /service/ { proxy_set_header Host $host:$server_port; proxy_set_header X-Forwaded-For $remote_addr; proxy_set_header X-Forwaded-Scheme $scheme; proxy_pass http://127.0.0.1:8302; } location ^~ /his/ { proxy_set_header Host $host:$server_port; proxy_set_header X-Forwaded-For $remote_addr; proxy_set_header X-Forwaded-Scheme $scheme; proxy_pass http://127.0.0.1:8302; } location ^~ /static/ { root /home/hcare/support/application/EFT-P9/frontend/client/html; } location ~ .*\.(gif|jpg|jpeg|png)$ { expires 24h; root /data/EFT-P9/pic/;#指定图片存放路径 #access_log /usr/local/nginx/logs/images.log;#日志存放路径 proxy_store on; proxy_store_access user:rw group:rw all:rw; proxy_temp_path /data/EFT-P9/pic/;#图片访问路径 proxy_redirect off; proxy_set_header Host 127.0.0.1; client_max_body_size 10m; client_body_buffer_size 1280k; proxy_connect_timeout 900; proxy_send_timeout 900; proxy_read_timeout 900; proxy_buffer_size 40k; proxy_buffers 40 320k; proxy_busy_buffers_size 640k; proxy_temp_file_write_size 640k; if ( !-e $request_filename) { proxy_pass http://127.0.0.1;#默认80端口 } } location ~ .*\.(txt|pdf|doc|docx|xls|xlsx)$ { expires 24h; root /data/EFT-P9/file/;#指定图片存放路径 #access_log /usr/local/nginx/logs/images.log;#日志存放路径 proxy_store on; proxy_store_access user:rw group:rw all:rw; proxy_temp_path /data/EFT-P9/file/;#访问路径 proxy_redirect off; proxy_set_header Host 127.0.0.1; client_max_body_size 10m; client_body_buffer_size 1280k; proxy_connect_timeout 900; proxy_send_timeout 900; proxy_read_timeout 900; proxy_buffer_size 40k; proxy_buffers 40 320k; proxy_busy_buffers_size 640k; proxy_temp_file_write_size 640k; if ( !-e $request_filename) { proxy_pass http://127.0.0.1;#默认80端口 } } error_page 404 = http://11.21.1.120:8304/#/404; } # Virtual Host configuration for example.com # # You can move that to a different file under sites-available/ and symlink that # to sites-enabled/ to enable it. # #server { # listen 80; # listen [::]:80; # # server_name example.com; # # root /var/www/example.com; # index index.html; # # location / { # try_files $uri $uri/ =404; # } #}
09-05
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值