loading...

(Solved)Apache2 virtualhost problem for Wordpress 5 local config

wolfiton profile image wolfiton ・3 min read

Hi everyone,

I have a problem with Wordpress Apache2 Virtualhost and rewrite through .htaccess.
Update:
After deleting the cache several times and also completely stoped apach2 and start it again it works.

My config looks like this for apache2 virtualhost:

<VirtualHost *:80>

     DocumentRoot /var/www/example.com/
     ServerName example.com
     ServerAlias www.example.com

     <Directory /var/www/example.com/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>


I also have this in my /etc/hosts:

127.0.0.1 example.com

If I enable the vhost in apache2 with sudo a2eniste exmaple.com and reatrt the server with sudo systemctl apache2 reload and also test the config with apachectl configtest. All is correct and I get

apachectl configtest                                                                   
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK

Also the permissions on example.com and on the files and folders:

ls -ail /var/www/example.com                                                             
total 220
55577117 drwxr-xr-x  5 www-data www-data  4096 mai 30 13:26 .
55590166 drwxr-xr-x  4 root     root      4096 mai 30 13:53 ..
55575637 -rw-r--r--  1 www-data www-data   481 mai 30 13:27 .htaccess
42995800 -rw-r--r--  1 www-data www-data   405 feb  6 08:33 index.php
42995817 -rw-r--r--  1 www-data www-data 19915 feb 12 13:54 license.txt
42995782 -rw-r--r--  1 www-data www-data  7278 ian 10 16:05 readme.html
42997479 -rw-r--r--  1 www-data www-data  6912 feb  6 08:33 wp-activate.php
42997480 drwxr-xr-x  9 www-data www-data  4096 apr 29 21:58 wp-admin
42995781 -rw-r--r--  1 www-data www-data   351 feb  6 08:33 wp-blog-header.php
42998543 -rw-r--r--  1 www-data www-data  2275 feb  6 08:33 wp-comments-post.php
42995807 -rw-r--r--  1 www-data www-data  2889 mai 24 17:29 wp-config.php
42995818 drwxr-xr-x  7 www-data www-data  4096 mai 29 13:50 wp-content
42995805 -rw-r--r--  1 www-data www-data  3940 feb  6 08:33 wp-cron.php
42996116 drwxr-xr-x 21 www-data www-data 12288 apr 29 21:58 wp-includes
42996114 -rw-r--r--  1 www-data www-data  2496 feb  6 08:33 wp-links-opml.php
42996115 -rw-r--r--  1 www-data www-data  3300 feb  6 08:33 wp-load.php
42995815 -rw-r--r--  1 www-data www-data 47874 feb 10 05:50 wp-login.php
42996113 -rw-r--r--  1 www-data www-data  8509 apr 14 14:34 wp-mail.php
42995816 -rw-r--r--  1 www-data www-data 19396 apr 10 06:59 wp-settings.php
42995797 -rw-r--r--  1 www-data www-data 31111 feb  6 08:33 wp-signup.php
42998542 -rw-r--r--  1 www-data www-data  4755 feb  6 08:33 wp-trackback.php
42995777 -rw-r--r--  1 www-data www-data  3133 feb  6 08:33 xmlrpc.php

So I am wondering what am I doing wrong and how it can be fixed?

Thanks in advance

Posted on May 30 by:

wolfiton profile

wolfiton

@wolfiton

I am a certified trainer that likes to share my knowledge with the world. Also, I am an adopter of continuous learning and evolving idea. https://dev.to/wolfiton/who-am-i-3lj7

Discussion

markdown guide