x10Hosting Forums

Corporate Free Hosting for the Masses.



Register

Reply
 
LinkBack Thread Tools Display Modes
Server Tech

Christopher's Avatar

Join Date: Jun 2006
Posts: 6,860
Credits: 94,820
Christopher has a reputation beyond repute
Location: USA

Quote  
06-28-2008, 11:00 PM
[Ubuntu] Lighttpd

Introduction

So you just got your VPS and thinking "Now what?". In this tutorial I will show you how to get lighttpd running and how to configure it. Lighttpd is a web server similar to apache. Only it uses less system resources. This tutorial will be released in multiple parts. It is written for Ubuntu but may work on other operating systems.
This tutorial assumes that you know how to log into ssh. Anything written in italics is something you should run in the terminal.

Requirements

Nano - apt-get install nano
Cron - apt-get install cron

Stuff you might want to know

To save a file in nano, type ctrl - x, y, enter.
You should not have anything installed that is using port 80.
This tutorial is written for Ubuntu.

Part 1 - Installing Lighttpd

Installation is very simple. Simply run apt-get install lighttpd. Once that finishes you have a fully working lighttpd! Check http://yourvpsip and you should get a page similar to the one at http://server.fyepro.com/. If it doesn't work, make sure you don't have anything else running on port 80 such as apache.

Part 2 - Installing PHP
So now you've got lighttpd running. Time to install PHP. If you don't need php, just skip this. We are going to use FastCGI to provide php support. To start, run apt-get install php5-cgi.
Now we need to edit the php configuration file. Run nano /etc/php5/cgi/php.ini. At the end of that file add
Code:
cgi.fix_pathinfo = 1
Now we need to enable FastCGI in lighttpd. To do so, run nano /etc/lighttpd/lighttpd.conf. Now look for
Code:
server.modules              = (
Directly underneath that add
Code:
            "mod_fastcgi",
Now add
Code:
fastcgi.server = ( ".php" => (( 
                     "bin-path" => "/usr/bin/php5-cgi",
                     "socket" => "/tmp/php.socket"
                 )))
to the end of the file.
Now you are almost done! Just run /etc/init.d/lighttpd restart to restart lighttpd and php is good to go!
For php modules, check out http://packages.ubuntu.com/search?su...keywords=php5-
Install them using apt-get install [packageName] and then restart lighttpd using nano /etc/lighttpd/lighttpd.conf.
Only install the ones you need! Installing ones you don't need will take up unnecessary RAM.

Part 3 - Using multiple domains

In this part I will be explaining how to use more than one domain. Similar to parked and addon domains in cPanel. If you are going to use more than one domain, I recomend you keep your sites out of the root /var/www/. Helps keep things neater. But that's up to you. In this tutorial I will assume that you are putting your sites in a subfolder of the /var/www/ folder. You can put them elsewhere but you need to mess with permission stuff which I wont cover here. Now to get started.
First, open your lighttpd config file with the command nano /etc/lighttpd/lighttpd.conf. Now add the code below to the end of the file. I'll explain what it all means shortly.
Code:
$HTTP["host"] == "SITEURL" {
  server.document.root = "/var/www/FOLDER/"
}
Replace SITEURL with the domain of your site. Replace FOLDER with the folder you put the files in. Make sure you keep the last /. If you need any other special configurations for that domain (they will be covered later) add them before the }.

Up Next: Redirects & Rewrites

Notes and references
PHP Installation
MySQL setup will also be covered in a different tutorial. However, I need to finish optimizing my MySQL server first.
__________________

Win a domain or $10 paypal payout!
Do NOT PM staff for support! The PM will most likely be ignored.

Last edited by Christopher; 06-29-2008 at 03:32 PM.
Reply With Quote
Christopher is online nowReport Post
Server Tech

Christopher's Avatar

Join Date: Jun 2006
Posts: 6,860
Credits: 94,820
Christopher has a reputation beyond repute
Location: USA

Quote  
06-29-2008, 02:59 PM
Re: [Ubuntu] Lighttpd

Reserved

Last edited by Christopher; 06-29-2008 at 02:59 PM.
Reply With Quote
Christopher is online nowReport Post
Server Tech

Christopher's Avatar

Join Date: Jun 2006
Posts: 6,860
Credits: 94,820
Christopher has a reputation beyond repute
Location: USA

Quote  
06-29-2008, 02:59 PM
Re: [Ubuntu] Lighttpd

Reserved

Last edited by Christopher; 06-29-2008 at 03:00 PM.
Reply With Quote
Christopher is online nowReport Post
Blaze of Glory

Join Date: Apr 2006
Posts: 561
Credits: 3,670
Nathan H will become famous soon enough
Quote  
07-06-2008, 03:27 PM
Re: [Ubuntu] Lighttpd

For those not on ubunto much of this tutorial will still apply because apt-get will also (normaly) download everything else (dependancies) needed. For those who cannot get apt-get to work, you might be on a slightly different type of shell, use yum instead of apt-get and it should work
__________________
Nathan H Formerly UnFoundBug



http://www.theadmin.co.uk - Yes i know the colours don't go, I'm working on it.

VPS Admin | x10-commandments
These results are to be used as a GUIDE ONLY


So thats where it went! I thought i was losing my mind.
Reply With Quote
Nathan H is offlineReport Post
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 06:32 PM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC7
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

Loans | Credit Card | Credit Card Consolidation | Loan | Personal Loans