简体   繁体   中英

drupal7: The web service endpoint returned a “HTTP/1.1 403 Forbidden” response

There are 12 or so similar questions but not drupal related. Here is my site on a digitalocean droplet: http://104.236.27.226/

It is apache2 on ubuntu16 php7. I am using: 000-default.conf:

ServerName casey.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory "/var/www/html">
  AllowOverride All
  Require all granted 
</Directory>

I made file permission as permissive as possible:

drwxrwsrwx  4 casey    www-data 4096 Sep 20 12:15 www/

I put an echo in the settings.php, at the very end to show the user for apache:

casey@dchouse02:/var$ tail -n 3 www/html/sites/default/settings.php
echo('<h4>ECHO: from setting.php after databases array; and apache user is (via exec whoami): '); 
echo exec('whoami'); echo ('</h4>');

Knowing that settings.php is being read, I moved to indx.php for this D7 site:

casey@dchouse02:/var$ tail -n 3 www/html/index.php 
echo('<p>from index.php: before menu_execute_active_handler:</p>');
menu_execute_active_handler();
echo('<p>After menu_execute_active_handler</p>'); 

At this point the error appears:

The web service endpoint returned a "HTTP/1.1 403 Forbidden" response 

The list of apache processes look similar to what I get from the ubuntu on my laptop:

casey@dchouse02:/var$ ps aux | grep apache
root     16068  0.0  4.7 327752 23512 ?        Ss   16:59   0:00 /usr/sbin/apache2 -k start
www-data 16071  0.0 10.2 345548 51244 ?        S    16:59   0:00 /usr/sbin/apache2 -k start
www-data 16072  0.0 10.2 343656 51176 ?        S    16:59   0:01 /usr/sbin/apache2 -k start
www-data 16073  0.0 10.7 347648 53632 ?        S    16:59   0:00 /usr/sbin/apache2 -k start
www-data 16074  0.0 11.1 349660 55520 ?        S    16:59   0:01 /usr/sbin/apache2 -k start
www-data 16075  0.0 10.1 345548 50888 ?        S    16:59   0:01 /usr/sbin/apache2 -k start
www-data 16099  0.0 10.0 343428 50248 ?        S    16:59   0:00 /usr/sbin/apache2 -k start
www-data 16764  0.0 10.3 345600 51792 ?        S    18:37   0:00 /usr/sbin/apache2 -k start
www-data 17344  0.0  1.3 327784  6612 ?        S    21:38   0:00 /usr/sbin/apache2 -k start
www-data 17347  0.0  1.3 327784  6612 ?        S    21:38   0:00 /usr/sbin/apache2 -k start

I don't know what else to do in trouble shooting this. Any assistance will be appreciated.

Try opening apache settings file:

sudo nano /etc/apache2/envvars

And find rows where apache user is defined, something like:

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data 

Then you can check from console can that user access your directory or eventually change the apache user to some other that can.

Adding a final / in the DocumentRoot did the trick:

DocumentRoot /var/www/html/
<Directory "/var/www/html/">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM