• Setting up WordPress on a brand new system with Ubuntu 24.04, Nginx, Let’s Encrypt, MySQL, and PHPMyAdmin. Nbinx, MySQL and PHPMyAdmin appear to be properly configured and working as I have total control of the database through PHPMyAdmin. I configured the nginx configuration file for my site, downloaded WP and installed and made the appropriate changes to wp-config.php. Everything went smoothly until I entered https://mysite.com/wordpress which returned 403 forbidden.

    WordPress has not yet set up an error log. MySQL error log had no reports. Nginx error log had the following report:

    2025/02/01 02:42:05 [error] 5780#5780: *177 directory index of “/var/www/mysite/wordpress/” is forbidden, client: 127.0.0.1, server: site1.com, request: “GET /wordpress/ HTTP/1.1”, host: “mysite.com”

    Any help would be appreciated.

Viewing 8 replies - 1 through 8 (of 8 total)
  • 2025/02/01 02:42:05 [error] 5780#5780: *177 directory index of “/var/www/mysite/wordpress/” is forbidden, client: 127.0.0.1, server: site1.com, request: “GET /wordpress/ HTTP/1.1”, host: “mysite.com”

    This seems to be a path issue.

    I’m going to assume the wordpress directory contains your WordPress folders (wp-admin, wp-content & wp-includes), the various wp-* files, and, crucially, the index.php PHP file. If not, this is your issue that you need to fix because the above log suggests there’s no index file to display and directory indexing is not permitted, hence the 403 error.

    Next, try this: put a static test.html file into the wordpress directory. Can you access it at https://mysite.com/wordpress/test.html?

    If you get 404, you can rule out MySQL, PHP and even WordPress from this: your problem is a simple path issue in your webserver configuration for the virtual host. Check your Nginx server block for the vhost: does it point to /var/www/mysite (ie without the wordpress)?

    (Aside: Unless this is just a development site, why would you want to tag the /wordpress/ path in front of your site’s URLs? If this is your production setup, you want to install WordPress with the proper address from the get-go… else you’ll have to go through some rigamarole to change the WordPress site address later on.)

    Thread Starter wrknight

    (@wrknight)

    Many thanks for your help. You are correct in assuming that wp-admin and others are in the wordpress folder. The exact path is /var/www/mysite/wordpress/wp-admin, etc.

    I put a test.html file in the wordpress folder with a simple message and when I put https:mysite/wordpress/test.html in the browser, the test message popped right ujp. So the path seems to working as it should.

    This is a development site as I wish to move my blog to my own host. I actually have two sites and ultimately want to host both on my own system. I originally started to set up a multisite wordpress but lost the bubble on that one and decided to start fresh with everything new. I am totally unfamiliar with virtual hosting and would like to know more about it.

    In the mean time, I want to crack this nut and get the original site back on line.

    Again, many thanks for your help.

    • This reply was modified 1 month, 2 weeks ago by wrknight.

    Many thanks for your help. You are correct in assuming that wp-admin and others are in the wordpress folder. The exact path is /var/www/mysite/wordpress/wp-admin, etc.

    Can you find WordPress’ index.php file here? If not, your WordPress files are not complete!

    If the file is there, we need to investigate why it’s not loading. First, rename your test.htnl file to index.html and hit https://mysite/wordpress/ (don’t include the index.html)

    Does this load the content of your index.html file?

    Thread Starter wrknight

    (@wrknight)

    There is an index.php file in the wordpress folder.

    I renamed the test.html to index.html, entered https://mysite/wordpress in the browser and the test file popped right up.

    I suspect I have mysql issues with usernames and passwords as I wasn’t too sure what usernames and passwords to put in. (I have too many usernames and passwords in my system.)

    Again, thanks.

    Thread Starter wrknight

    (@wrknight)

    Update: Progress – I think.

    I added a separate server block for wordpress in my nginx config file that was identical to the phpmyadmin block (just changed the names) Now I am not getting any nginx error messages. Instead, I am now getting “Error establishing a database connection.”

    I suspect I have mysql issues with usernames and passwords as I wasn’t too sure what usernames and passwords to put in. (I have too many usernames and passwords in my system.)

    If this were the cause, WordPress’ index.php would load, and WordPress would then throw a database connection error. But the Nginx error in your original post suggest index.php is not being loaded at all.

    I don’t believe this is a WordPress or database problem. As your static .html files are loading, this means Nginx itself is working fine, though they may be an issue with the server block. I suspect PHP may not be working at all in this vhost. I would test to see if PHP is working in this vhost by creating a test.php file with the single line code: <php phpinfo(); ?> . Can you get this to load?

    Sorry, I didn’t see your second response before sending my response above.

    Instead, I am now getting “Error establishing a database connection.”

    OK, this means WordPress (and thus PHP) is now loading, and the error is a MySQL database connection problem. If phpMyAdmin is working, that also means MySQL is running fine, and it’s a simple credentials problem which should be easy to fix.

    Thread Starter wrknight

    (@wrknight)

    It’s definitely a mysql problem at this point. Unfortunately, I seem to have lost my root privileges in mysql. I have no idea how that happened but I am constantly getting permission denied messages. It’s going to take some time to get untangled. In the meantime, I really appreciate your help. It has helped me learn a lot.

    Thanks again.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.