• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » Install WordPress in a Subdirectory on Nginx (Ubuntu, Rackspace Cloud)

By Abhishek Ghosh October 24, 2014 10:48 am Updated on October 24, 2014

Install WordPress in a Subdirectory on Nginx (Ubuntu, Rackspace Cloud)

Advertisement

Here is how to install WordPress in a subdirectory on Nginx taking it granted that the device is running Ubuntu as Rackspace Cloud Server PVHVM Multi-Instance (i.e. Application Server is Different than Web Server). At minimum, you should be using a standard way of installing Nginx on Rackspace Cloud on one server instance. We can NOT provide any warranty of working fine with the exact codes if your setup is quite different AS custom setup of Nginx can vary widely, i.e. Nginx can be configured with LuaJit.

 

The Ideal Example Situation to Install WordPress in a Subdirectory on Nginx (Ubuntu, Rackspace Cloud)

 

Suppose, you used a different PHP based software for podcast or used a subdomain. Now with HTTPS or with practical issues with the Podcast software, you want to use the podcast subdirectory to install a Fresh, new WordPress which is fully separate from your main WordPress – i.e. not a WordPress Multisite. There are some basic Tricks to Install WordPress in a Subdirectory on Nginx in a Standard Setup. Usually, by default pretty permalinks of WordPress will not work on the subdirectory. That is what is the basic problem which will provide you solution.

 

Install WordPress in a Subdirectory on Nginx (Ubuntu, Rackspace Cloud)

 

Read our detailed guide to install WordPress, if you are fully new. SSH to your Database Server and create a new database, an user and give the user access to the database :

Advertisement

---

/root
Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mysql -u root -p
# change wordpress, it is an example
CREATE DATABASE wordpress;
# wordpressuser should be changed, it is example, so is password
CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';
# we will use localhost on one server
# we will use the servicenet IP / Private IP with separate database server
# modify accordingly
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
exit
# may be?
apt-get update -y && apt-get upgrade
# exit from ssh if database server is different
exit

Keep the details on a separate text file. Now, SSH to your web server as root. Create the subdirectory, if does not exist :

/root
Vim
1
2
mkdir -p /usr/share/nginx/html/your-subdomain
# default location on Ubuntu for apt based nginx

Simply CD to the subdirectory and wget WordPress, un-tar it :

/usr/share/nginx/html/your-subdomain
Vim
1
2
3
4
5
6
7
8
cd /usr/share/nginx/html/your-subdomain
# default location on Ubuntu for apt based nginx
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
cd wordpress
mv * .. && cd ..
rm -r wordpress latest.tar.gz && ls
# see the files

Point to the desired url on browser like :

Vim
1
https://jima.in/your-subdomain

Fill up the web form and continue to undergo infamous 5 minutes installation. (Why Infamous? It takes 60 seconds on $5 / month Hostgator, thats why it is hugely used by the spammers, Google possibly thinks WordPress can be spammy, thats why its infamous…)
Aha, WordPress will tell you that it has no right permission to write (no right to write lol) to create the file wp-config.php, instead will give you what to write as plain text file. Highlight the fully text and copy it. Create wp-config.php and paste the material, then save it :

/usr/share/nginx/html/your-subdomain
Vim
1
2
3
4
nano wp-config.php
# paste
# write out with ^ + O
# exit with ^ + X

Continue browser works. So your WordPress is ready, but many things are not ready. First, change the permissions :

/usr/share/nginx/html/your-subdomain
Vim
1
2
3
4
5
6
7
8
9
pwd
# never run "sudo chmod chown root:www-data" command while at root without path
# unix will test your knowledge instantly
# it is safe to be at the directory to change ownership
cd /usr/share/nginx/html/your-subdomain
sudo chown root:www-data /usr/share/nginx/html/your-subdomain -R
sudo chmod g+w /usr/share/nginx/html/your-subdomain -R
sudo chgrp -R www-data /usr/share/nginx/html/your-subdomain
# change /your-subdomain/

But, your pretty permalinks will not work unless you define the things how to be handled by Nginx, so open the default domain config file (i.e. /etc/nginx/sites-available/default by default) :

/etc/nginx/sites-available/default
Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# this is almost flawless for HTTPS website
# only link to wp-admin dashboard will not work
# from frontend wordpress admin menu bar
# copy from the next line
location /your-subdomain {
     index index.php;
     rewrite ^/your-subdomain/(.*)+$ /your-subdomain/index.php?$1;
}
# stop copying
# your-subdomain is not your name, change it
# where to paste?
# within
# HTTPS server
#server {
#}
# block or post plain server block if you are not secure
# find the last "}" and paste before it
# save with ^ + O and Exit with ^ + X
# do a config test
nginx -t
# restart if output is fine
service nginx restart
# set the appropriate permalink structure from wp admin
# your w3tc 's rerite will look like this :
if (!-f "$document_root/your-subdomain/wp-content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_rewrite.html$w3tc_enc") {
  set $w3tc_rewrite 0;
}

Lot of peoples on stack overflow will flow huge knowledge on only this block, but our method will work with WordPress SEO, Genesis and W3tC without any problem. Your subdirectory will exactly follow the rules of server block, if you do not know anything about NAXSI (Nginx Anti Xss & Sql Injection), you should never try the other methods. What a particular rewrite rule can make a WordPress plugin to be point to becoming vulnerable, we will not expose. Even if you have not configured NAXSI, on Rackspace, with this rules on Infrastructure Managed, it is unlikely to invite SQL injection. Here is the philosophy of NAXSI :

Install WordPress in a Subdirectory on Nginx (Ubuntu, Rackspace Cloud)

There is nothing more to write!

Tagged With htmly nginx subdirectory , instaall wordpress subdirectory nginx , install wordpress in subdirectory nginx ubuntu , install wordpress nginx in a sub directory , nginx subdirectory privileges , nginx subdirectory rewrite joomla ubuntu , nginx wordpress in subdirectory , put wordpress in sub directory nginx , ubuntu nginx subdomain

This Article Has Been Shared 580 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Install WordPress in a Subdirectory on Nginx (Ubuntu, Rackspace Cloud)

  • Cloud Apps Compared : Google Apps and Microsoft Office 365

    Cloud Apps like e-mail or office apa are enormously used now.Cloud based services like Google Apps, Microsoft Office 365 offers a cost effective way for these.

  • Security in the Cloud : Visibility and Control

    Security in the Cloud and Privacy are often blamed as the main problems for shifting to Cloud Computing Platform. But are they really true headache ?

  • OpenStack, HP and Microsoft Private Cloud : The Complex Cloud

    OpenStack is Open Source Cloud Computing Software, HP is among contributor. HP recently has published a paper dedicated to Microsoft private cloud architecture.

  • Cloud Based Mobile App Development : Junior for HTML5 Mobile Apps

    Cloud Based Mobile App Development can be coded easily for the back-end. It is the Front-end which creates confusion to many. Junior is front-end framework.

  • Fix Nova Agent Not Working ( Rackspace Cloud, Ubuntu )

    Here Is How To Fix Nova Agent Not Working After Running Upgrade or Automated System Restart. It is nothing but again creating symlinks.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What is Configuration Management February 5, 2023
  • What is ChatGPT? February 3, 2023
  • Zebronics Pixaplay 16 : Entry Level Movie Projector Review February 2, 2023
  • What is Voice User Interface (VUI) January 31, 2023
  • Proxy Server: Design Pattern in Programming January 30, 2023

About This Article

Cite this article as: Abhishek Ghosh, "Install WordPress in a Subdirectory on Nginx (Ubuntu, Rackspace Cloud)," in The Customize Windows, October 24, 2014, February 5, 2023, https://thecustomizewindows.com/2014/10/install-wordpress-subdirectory-nginx-ubuntu-rackspace-cloud/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT