Question

Install and configure wordpress on lemp on ubuntu 16.04 with wordpress in subdirectory

This question has been asked a lot and so far solutions have only been posted for LAMP. How about we get an answer for this and put it into a tutorial?

The root of the website should be static or php without wordpress installed in it. Call it mywebsite.

A subdirectory, let’s say blog, has wordpress installed in it => https://mywebsite/blog will access the blog.

This is to be done with one DO instance and managed by nginx server blocks, I presume.

The problem I’ve had is that the wordpress admin panel doesn’t respect https://mywebsite/blog (by checking the page source of the admin panel) and attempts to load external files by https://mywebsite.

Is this a wordpress problem or a configuration problem?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Did you install WordPress in that location originally? If not, then you need to adjust your URL in the configuration at https://mywebsite/blog/wp-admin/options-general.php so it includes the /blog/ part There might be some stuff still left in the database, but we can search/replace that once the other part is done.

I’ve edited the database and now I can display the blog page, but I can’t login with wp-admin. It refuses my username and password. When I attempt to recover the password it doesn’t recognise my email address.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.