• 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 947 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Orthopaedic 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

You can subscribe to our Free Once a Day, Regular Newsletter by clicking the subscribe button below.

Click To Subscribe

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 (20K Followers)
  • Twitter (4.9k Followers)
  • Facebook (5.8k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.2k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Cloud Computing : Cybersecurity Tips for Small Business Owners January 20, 2021
  • Arduino : Independently Blink Multiple LED January 18, 2021
  • What is a Loosely Coupled System? January 17, 2021
  • How To Repack Installed Software on Debian/Ubuntu January 16, 2021
  • Components of Agile Software Development January 15, 2021

 

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, January 20, 2021, https://thecustomizewindows.com/2014/10/install-wordpress-subdirectory-nginx-ubuntu-rackspace-cloud/.

Source:The Customize Windows, JiMA.in

 

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Cookie Policy.

PC users can consult Corrine Chorney for Security.

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

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

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