Ask Your Question

Can't access localhost Wordpress sites since F27 update! (logs included, (13)Permission denied))

asked 2017-11-22 05:35:13 -0500

David-LDA gravatar image


Everything was working great on Fedora 26. I have all my local development sites living in HOME/sites in folders. I did an update to Fedora 27 via DNF that seemed to go well. The httpd.conf file does not seem to have changed.

The logs at the bottom show a (13)Permission denied, could this be SELinux?

I set it up to work with the following options (when I did a clean install of Fedora 26):

sudo dnf -y install php phpmyadmin php-mysqlnd php-opcache mariadb-server sendmail

# Make a directory for websites/apps and add the permissions
mkdir ~/sites
sudo ln -s ~/sites /var/www/html # make symbolic link from the apache web directory to sites folder
chcon -R unconfined_u:object_r:httpd_sys_rw_content_t:s0 ~/sites # tell SELinux that these files/directories are allowed to be modified by Apache

# Change the "User apache" string in the config file to "User (the username of the current user)". For a development machine, it's more convenient to run Apache as the current user to simplify permissions problems
sudo sed -i "s/User apache/User $USERNAME/g" /etc/httpd/conf/httpd.conf

# Change PHP settings to mirror the production server, and allow more functionality
upload_max_filesize=128M # namesco default setting
post_max_size=128M       # namesco default setting
max_execution_time=60    # namesco default setting, Avada theme recommends 180

for key in upload_max_filesize post_max_size max_execution_time; do
    sudo sed -i "s/^\($key\).*/\1 = $(eval echo \${$key})/" /etc/php.ini

sudo systemctl start mariadb.service # start the MYSQL database
sudo mysql_secure_installation       # finish installation of MYSQL to make it secure

with the final mod being:

# sudo gedit /etc/httpd/conf/httpd.conf
# allow mod-write
# ---------------
# 2.  # AllowOverride controls what directives may be placed in .htaccess files.
#     # It can be "All", "None", or any combination of the keywords:
#     #   Options FileInfo AuthConfig Limit
#     #
#     AllowOverride All

but now as soon as I point to the site http://localhost/sites/sitename/ I get 503 Service Unavailable

I am not an expert in servers, it took me a very long time to make this all work! does anyone know what has changed in Fedora 27 or what could have gone wrong?!

THANKS! Here is some more info from the command line:

$ systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
   Active: active (running) since Wed 2017-11-22 09:48:25 GMT; 1h 33min ago
     Docs: man:httpd.service(8)
  Process: 4450 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
 Main PID: 3584 (httpd)
   Status: "Total requests: 26; Idle/Busy workers 100/0;Requests/sec: 0.00463; Bytes served/sec:  35 B/sec"
    Tasks: 213 (limit: 4915)
   CGroup: /system.slice/httpd.service
           ├─3584 /usr/sbin/httpd -DFOREGROUND
           ├─4453 /usr/sbin/httpd -DFOREGROUND
           ├─4455 /usr/sbin/httpd -DFOREGROUND
           ├─4456 /usr/sbin/httpd -DFOREGROUND
           └─4457 /usr/sbin/httpd -DFOREGROUND

$ sudo apachectl configtest
Syntax OK

sudo more /var/log/httpd/error_log
[Wed Nov 22 10:36:02 ...
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2017-11-22 06:44:18 -0500

remi gravatar image

updated 2017-11-22 07:40:59 -0500

First read: Fedora 27: changes in httpd and php

As you have changed default user of running httpd process, you also need to fix php-fpm configuration

Change its user to match previous, in /etc/php-fpm.d/www.conf

user = david

And allow httpd process to connect to the unix socket

listen.acl_users = david

Then restart php-fpm

systemctl restart php-fpm
edit flag offensive delete link more

Question Tools


Asked: 2017-11-22 05:35:13 -0500

Seen: 448 times

Last updated: Nov 22 '17