Solved

Ubuntu & Wordpress: setting wildcard domain?

Posted on 2010-11-16
4
510 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Wordpress Horizontal Drop-Down Menu In this tutorial I will show you had to add a WordPress horizontal navigation menu to your theme. I have searched and searched for a good tutorial on creating a WordPress nav menu without adding a plug-in or us…
This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

828 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