Posts Tagged ‘Apache’

Getting two domains on one IP

I recently had a request from someone on how to setup multiple domains on a single IP address. This is something that I’ve thought about doing before, but haven’t taken the time to stop and set it up. After getting sub-domains working, this was a breeze, as it’s the same process. I’m working on an Ubuntu server, so this may be a little different for you.

DNS

First setup the DNS, since it will probably take about an hour for that to update anyway, depending on the TTY that you use. If you’re setting this up and you want to make sure it works, you can edit your /etc/hosts file on a mac or linux machine. I think there’s a way to do this in windows as well, but I’m not sure of what file you’d be looking for. Just remember to delete that entry after you know it works.

To setup the DNS you first need to find the DNS control for the domain registrar that you use. In GoDaddy the option would be called Total DNS. Change the A record to the IP address you want to use as a server and you’re done.

Configuration

Now you need to create a new file in /etc/apache2/sites-available/. Call it whatever you want. I will call it NEWSITE.TLD. In this file you will create a new file that looks similar to this, only substituting information specific to your server:


NameVirtualHost *:80


	ServerAdmin you@your-domain.tld
	ServerName your-domain.tld

	DocumentRoot /var/www/your-root/

	
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	

	ErrorLog /var/log/apache2/error.log
	LogLevel warn
	CustomLog /var/log/apache/access.log combined
	ServerSignature On


Now we enable the site with:


sudo a2ensite /etc/apache2/sites-available/NEWSITE.TLD

Reload the apache configuration and you should be good to go.

Published: August 25th, 2009 in Tech, Web | Tags: , , , ,

Enable mod_rewrite

To enable mod_rewrite in Apache it is very simple. First you change this line ‘#LoadModule rewrite_module modules/mod_rewrite.so’ to ‘LoadModule rewrite_module modules/mod_rewrite.so’. Then you change this line ‘AllowOverride None’ under ‘# Options FileInfo AuthConfig Limit’ to ‘AllowOverride All’. Quite simple

Published: June 7th, 2007 in Asides | Tags:

Writable Folders

While installing Gallery2, after getting Apache installed on windows, I found that I needed to create a directory that was writable by apache so it could store my image files. I eventually found an article. It wasn’t about Gallery2, but it was close enough.

Basically you have to:

  1. go to a user’s “Local Settings” folder (ex. “C:\Documents and Settings\Default User\Local Settings”).
  2. Create a “web” folder
  3. Create your writable folder (ex. “C:\Documents and Settings\Default User\Local Settings\web\writable”
  4. Add the folder to the end of your apache configuration file (ex. php_value session.save_path “C:\Documents and Settings\Default User\Local Settings\web\writable”)

That’s it. That’s all I had to do.

Published: June 7th, 2007 in Tech | Tags: ,

Big Problems

Well I don’t know what caused this all to start, but whatever it was, it caused me a whole lot of trouble.

First, I couldn’t get the blog to show up. So I just restarted IIS and tried again. It didn’t work. So I restarted the server… Still nothing. Then I had an idea. I checked my home page and confirmed that something was wrong with my PHP installation. So I tried reinstalling it. I still couldn’t get it to work. For some reason it’s not easy to get PHP installed on an IIS server. I uninstalled and reinstalled PHP several times before deciding that this method wouldn’t work.

Then, I thought, if I can somehow get Apache installed on this server it would probably save me a lot of trouble. The only problem was that I’ve never been able to successfully install Apache on a Windows system — or on any system for that matter. I tried testing it on my computer. The first couple times I tried it didn’t really install. It would install the Apache Monitor, but no services would be installed. So I Googled it. I never really found the real reason why no services would install, but eventually I found a guide to installing Apache, and it gave me a different download site than the one I had been using. It was still Apache’s website, just a different page, with a list of a couple different versions.

After that, I installed Apache on my server, successfully, setup the default directory and default documents and it worked. Then I had to install PHP. I uninstalled the PHP that was already on there. Got rid of all the files, and then reinstalled it for an Apache server. Once I setup the extensions directory and added all the extensions it worked.

WordPress worked right away. I was very happy. Some of my other PHP scripts still don’t work yet. Like PHP weather, and Gallery2. It doesn’t really matter though, becuase PHP weather didn’t work right before anyway, so maybe now I’ll get it working properly. And I still have all the pictures that were in my gallery, and I still have the theme that I was using, so all I have to do is reinstall the Gallery and put the photos back in and put the theme back on there. It shouldn’t take too long.

Overall I’m not really mad that this happend. Other than the two hours or so of down time of course. But I finally got Apache installed and that will really help me a lot. If anybody knows what the download site I was talking about is, please post it on here. If anybody needs it, and nobody else has posted it yet, I could probably find it again.

Published: June 6th, 2007 in Tech | Tags: ,