Solved

Ubuntu & Wordpress: setting wildcard domain?

Posted on 2010-11-16
4
505 Views
Last Modified: 2012-05-10
Hi,

I'm a Linux noob ...

So I've managed to install Wordpress on my new Ubuntu server but now I want to activate the WP Network option. In order to do this I need to set a domain wildcard for my Ubuntu server

This page (http://codex.wordpress.org/Migrating_Multiple_Blogs_into_WordPress_3.0_Multisite) tells me to do this:

Create a wildcard subdomain. This should be as easy as going into cPanel and creating a subdomain named *.

But I don't have cPanel ... I'm working on a local server.

So how would I do this (I'm connected to my Ubuntu server via PuTTY)? Step by step please, as I don't know much about the Linux CLI ...

Thank you very much!

Jerome
0
Comment
Question by:Xeronimo
  • 3
4 Comments
 
LVL 19

Accepted Solution

by:
Barthax earned 500 total points
ID: 34162637
Having some vague understanding of cPanel, I expect the translation for you would be to set up a NameVirtualHost for your Apache.  Once you have a NameVirtualHost with corresponding VirtualHost tag, you can add a ServerAlias to the VirtualHost tag which accepts the wild card domain.

Command-line via PuTTY without much experience... I'm hoping you've settled on using a text editor you are comfortable with as you'll need to dip into text files to change them.  I'm also going to assume you have some base knowledge of directory navigation (ls & cd command particularly).

First, get a feel for your Apache 2 configuration folder and its layout (almost everything you do in for apache2 configuration will need to be done as root - get used to "sudo" before everything or use "sudo su" to run the terminal as root).  Base directory is /etc/apache2 and the main configuration file is apache2.conf.  Open that up & check at the bottom of the file - there should be (standard Ubuntu install) the directive "Include /etc/apache2/sites-enabled/".  If so, then you should find a pair of directories under the apache2 folder - sites-available and sites-enabled.  The idea behind the layout is you create all your sites in the sites-available folder and then create a symbolic link (symlink) to the configuration in the sites-enabled folder.

Check your sites-available folder & you should find a "default" file.  Open that up & check what is inside - I don't have a default anymore & it has been a long time since I did so I can't remember the content, sorry.  Anyway, you're likely to change it all. :)  In there you should find a NameVirtualHost at the top and a <VirtualHost *> tag underneath.  Inside the <VirtualHost *> tag you should find the name of your domain next to the ServerName directive.  Add a line underneath there with the ServerAlias directory and the wildcard you need.  So, for example, if the wildcard you need is *.mydomain.com use:

ServerAlias *.mydomain.com

Save the change.  Check in the sites-enabled folder and confirm the symlink is there for default (it should be if still base install).  Check your configuration is acceptable to Apache 2:

apache2ctl configtest

If that returns "Syntax OK" then you can ask Apache 2 to restart with the new config:

apache2ctl restart

Suggested further reading:
Apache Virtual Hosts documentation: http://httpd.apache.org/docs/2.0/vhosts/
Apache NameVirtualHost directive: http://httpd.apache.org/docs/2.0/mod/core.html#namevirtualhost
0
 
LVL 19

Expert Comment

by:Barthax
ID: 34162647
"Add a line underneath there with the ServerAlias directory"
should have been
"Add a line underneath there with the ServerAlias directive"
0
 

Author Closing Comment

by:Xeronimo
ID: 34170878
Thanks a lot for this precise answer!
0
 
LVL 19

Expert Comment

by:Barthax
ID: 34172523
No problem - glad to help. :)
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question