简体   繁体   中英

Apache configuration for wordpress gives 403 Forbidden

Tried for days to configure Apache to run wordpress on fresh Ubuntu install. The setup is as follows: - I have a domain with two subdomains 1- silex.mydomain.com 2- wp.mydomain.com - In apache I have to virtual hosts both use port 80 but uses ServerName to distinguish the site. - The silex.mydomain.com works fine for a silex php based website. - the wp.mydomain.com always gives 403 You don't have permission to access / on this server.

Here the config files of both sites are almost identical, only the servername, document root and such are different. Everything else is identical. here is the silex.conf file the rewrite mode is on by the way and for test I gave 770 permission with "myuser:www-data" ownership for the whole wordpress directory, there is no .htaccess there by default, I didn't add any.

   <VirtualHost *:80>
        ServerAdmin webmaster@mydomain.com

        DocumentRoot /opt/test/wordpress
        ServerName wp.mydomain.com
        <Directory /opt/test/wordpress/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                FallbackResource /index.php
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>


</VirtualHost>

I changed the Apache log to Debug and there it complained that it doesn't find .htaccess at /opt/test. Now that is sorted out, I had a bit mess of file permisstions that needs to be sorted out. Wordpress should have a script to take care of that.

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