How do I properly set up and secure a production LAMP Server?

Posted by Niklas on Ask Ubuntu See other posts from Ask Ubuntu or by Niklas
Published on 2011-09-06T19:41:24Z Indexed on 2011/11/12 10:14 UTC
Read the original article Hit count: 388

Filed under:
|
|
|
|

It's very hard to find comprehensive information on this subject. Either I found short tutorials on how you perform the installation, as simple as "apt-get install apache2", or outdated tutorials. So I was hoping I could get some professional information from my fellow members of the Ubuntu community :D

I have performed a normal Ubuntu Server 11.04 with LAMP, SAMBA and SSH installed through the system installation. But I'm having some trouble setting up virtual hosts and to make the system secure enough to expose the server to the web.

I've somewhat followed this tutorial this far.

I have 3 sites in /etc/apache2/sites-available which all looks like this except for different site names:

<VirtualHost example.com>
   ServerAdmin webmaster@localhost
   ServerAlias www.edunder.se
   DocumentRoot /var/www/sites/example
   CustomLog /var/log/apache2/www.example.com-access.log combined
</VirtualHost>

And I have enabled them with the command a2ensite so I have symbolic links in /etc/apache2/sites-enabled.

My /etc/hosts file has these lines:

127.0.0.1 localhost
127.0.1.1 Ubuntu.lan Ubuntu
127.0.0.1 localhost.localdomain localhost example.com www.example.com
127.0.0.1 localhost.localdomain localhost example2.com www.example2.com
127.0.0.1 localhost.localdomain localhost example3.com www.example3.com

And I can only access one of them from the browser (I have lynx installed on the server for testing purposes) so I guess I haven't set them up properly :)

How should I proceed to get a secure and proper setup? I also use MySQL and I think that this tutorial will be enough to set up SSH securely. Please help me understanding Apache configuration better since I'm new to setting up my own server (I've only run XAMPP earlier) and please advise regarding how I should setup a firewall as well :D

© Ask Ubuntu or respective owner

Related posts about 11.04

Related posts about server