The Perfect Server - Ubuntu Hardy Heron (Ubuntu 8.04 LTS Server) - Page 6

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Thu, 2008-04-24 14:13. ::

17 Apache/PHP5/Ruby

Now we install Apache:

apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert

Next we install PHP5 and Ruby (both as Apache modules):

apt-get install libapache2-mod-php5 libapache2-mod-ruby php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

Next we edit /etc/apache2/mods-available/dir.conf:

vi /etc/apache2/mods-available/dir.conf

and change the DirectoryIndex line:

<IfModule mod_dir.c>

          #DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
          DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml

</IfModule>

Now we have to enable some Apache modules (SSL, rewrite, suexec, and include):

a2enmod ssl
a2enmod rewrite
a2enmod suexec
a2enmod include

Reload the Apache configuration:

/etc/init.d/apache2 force-reload

In the next chapter (17.1) we are going to disable PHP (this is necessary only if you want to install ISPConfig on this server). Unlike PHP, Ruby is disabled by default, therefore we don't have to do it.

 

17.1 Disable PHP Globally

(If you do not plan to install ISPConfig on this server, please skip this section!)

In ISPConfig you will configure PHP on a per-website basis, i.e. you can specify which website can run PHP scripts and which one cannot. This can only work if PHP is disabled globally because otherwise all websites would be able to run PHP scripts, no matter what you specify in ISPConfig.

To disable PHP globally, we edit /etc/mime.types and comment out the application/x-httpd-php lines:

vi /etc/mime.types

[...]
#application/x-httpd-php                                phtml pht php
#application/x-httpd-php-source                 phps
#application/x-httpd-php3                       php3
#application/x-httpd-php3-preprocessed          php3p
#application/x-httpd-php4                       php4
[...]

Edit /etc/apache2/mods-enabled/php5.conf and comment out the following lines:

vi /etc/apache2/mods-enabled/php5.conf

<IfModule mod_php5.c>
  #AddType application/x-httpd-php .php .phtml .php3
  #AddType application/x-httpd-php-source .phps
</IfModule>

Then restart Apache:

/etc/init.d/apache2 restart

 

18 Proftpd

In order to install Proftpd, run

apt-get install proftpd ucf

You will be asked a question:

Run proftpd: <-- standalone

For security reasons add the following lines to /etc/proftpd/proftpd.conf (thanks to Reinaldo Carvalho; more information can be found here: http://proftpd.org/localsite/Userguide/linked/userguide.html):

vi /etc/proftpd/proftpd.conf

[...]
DefaultRoot ~
IdentLookups off
ServerIdent on "FTP Server ready."
[...]

ISPConfig expects the configuration to be in /etc/proftpd.conf instead of /etc/proftpd/proftpd.conf, therefore we create a symlink (you can skip this command if you don't want to install ISPConfig):

ln -s /etc/proftpd/proftpd.conf /etc/proftpd.conf

Then restart Proftpd:

/etc/init.d/proftpd restart


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Danuel (not registered) on Mon, 2009-05-11 09:42.

To speed up the login for ProFTP make sure instead of above code you put following:

 DefaultRoot        ~

# make it more secure and faster
<Global>
IdentLookups    off
ServerIdent        on "FTP Server ready."
</Global>
UseReverseDNS    off

The global tags are important.  Also see thread: http://www.howtoforge.com/forums/showthread.php?t=583&page=2

Submitted by lordspace (registered user) on Fri, 2009-04-17 17:22.

by doing this: Doesn't it cause a performance penalty because Apache has to check if each of those files exist.
the huge will be for the last index.xhmtl IMHO.

DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml

Submitted by anagai (registered user) on Fri, 2008-07-18 22:29.

apt-get install ssh openssh-server

I selected ssh on the initial ubuntu screen of programs to install and I also ran the above command after ubuntu was installed as recommended by this doc. Afterward i tried logging in using putty. I got 'connection refused error'.

I then looked elsewhere for help and found this command

apt-get install openssh-server

 After i ran this i was able to connect using putty. Command is only different than the other one by 'ssh'. Not sure why this works, but it works now.

Submitted by make-fun (registered user) on Mon, 2008-05-26 09:21.

Just run into another Bug in 8.04…

When PHP is run from the command line (CLI) you'll get ”PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/imagick.so' - libWand.so.9: cannot open shared object file: No such file or directory in Unknown on line 0

This reported as a Bug on:  PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/imagick.so' - libWand.so.9: cannot open shared object file: No such file or directory in Unknown on line 0

Submitted by sagor (registered user) on Fri, 2008-05-02 21:30.
Seems after installing ProFTP, the last line with the "Include" gives an error on the console on reboot. Just add a return after the include line at the bottom of etc/proftpd.conf, the error goes away.
Submitted by make-fun (registered user) on Mon, 2008-05-26 02:46.
Error:
Package php5-json is a virtual package provided by:
php5-common 5.2.3-1ubuntu6.1
You should explicitly select one to install.
E: Package php5-json has no installation candidate


php5-json comes with php5-common so their should be no need to install php5-json when you instal php5-common — I think.

So this worked for me so far…
apt-get install libapache2-mod-php5 libapache2-mod-ruby php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
Submitted by navegador (registered user) on Sat, 2008-07-05 23:38.

Thank you very much for this tip

It was the answer I need it in the right moment 

Submitted by yeltneb (registered user) on Sat, 2008-06-14 07:03.

Hi gand,

I was wondering if someone might be able to help me headed in the right direction as to what happened while I've been following the ISPconfig tutorial and I'm on the last couple of pages.

Error regarding "php5-json" - has no installation candidate

I'm stumped as to what this means, and after following the directions, word by word, making sure I didn't type anything in wrong, I don't know what is wrong here, or even where to start to look to find the problem, as all of these installations seem convoluted to me right now, and I know there is a log file for just about everything, but I am just not sure which log file would divulged the information I need to rectify the situation.

Any one that knows what this is or has a recommendation, I would greatly appreciate some assistance on this. I'm close, but I still have a ways to go before I learn more of this and can carry my own, and answer questions for others that will be in my place, and take the time to help them.

 

Thanks in advance,

Yeltneb 

Submitted by h@foorsa.biz (not registered) on Tue, 2008-09-23 03:53.
just remove the following form the apt-get php5-json everything would work fine
Submitted by make-fun (registered user) on Mon, 2008-05-26 02:38.
Same as Sagor…”Warning on strat up: - warning: handling possibly truncated configuration data at line 186 of '/etc/proftpd/proftpd.conf' “.

Also, in my case Proftp was not running afterwards for some reason. So I did a dpkg-reconfigure, but nothing got written to the config file — so switching from ServerType  ”inetd“ to  ”standalone“ did not work for me and I had to do it manually. This got nothing to do with the HowTo — I'm writing it just in case it's a general bug in 8.04