I bought a new VPS subscription and decided to install the open source ISPCP on it, as it has proven its excellence hosting my domains on c0urier’s home network. It seems to be on par with existing paid solutions like cpanel.
First thing you do is to get the software. It’s available as a tarball here.
Setting php settings for Debian server
I wanted to find out which config file is being used for “local value” in php for max uploads, max execution time etc. It seems to override my master value in the php.ini file.
I finally found out the configuration file which was overriding my master value. The funny thing is that it seems to be a Debian way of configuration, and not universal to apache2 and php. Hence it was undocumented anywhere in the Apache2 documentation.
After many hours of scratching my head, what helped me determine the file was this article. I quote the relevant info:
Active Configuration Files
# /etc/apache2/apache2.conf - pulls in additional # configurations in this order: Include /etc/apache2/mods-enabled/*.load Include /etc/apache2/mods-enabled/*.conf Include /etc/apache2/httpd.conf Include /etc/apache2/ports.conf Include /etc/apache2/conf.d/[^.#]* Include /etc/apache2/sites-enabled/[^.#]*
So ultimately what I did was to reach /etc/apache2 and do a full grep for “30”, the php execution time limit that was seen as local value.
[email protected]:/etc/apache2# grep -niR '30' * apache2.conf:67:Timeout 300 magic:693:0 belong 0x0e031301 application/x-hdf magic:728:#0 byte 0x30 magic:875:>30 string Copyright\ 1989-1990\ PKWARE\ Inc. application/x-zip magic:878:>30 string PKLITE\ Copr. application/x-zip mods-available/ssl.conf:44:SSLSessionCacheTimeout 300 mods-available/fastcgi_imscp.conf:42: -idle-timeout 300 mods-available/fastcgi_imscp.conf:47: FastCgiServer /var/www/fcgi/master/php5-fcgi-starter -user vu2000 -group vu2000 -idle-timeout 300 mods-available/fcgid_imscp.conf:37: BusyTimeout 300 mods-enabled/ssl.conf:44:SSLSessionCacheTimeout 300 sites-available/joel.co.in.conf:110: php_admin_value max_execution_time 30 sites-available/joel.co.in.conf:113: php_value error_reporting 30711 sites-enabled/joel.co.in.conf:110: php_admin_value max_execution_time 30 sites-enabled/joel.co.in.conf:113: php_value error_reporting 30711
As you can see the first file that shows 30 secs is this: /etc/apache2/sites-enabled/joel.co.in.conf
So I edited it:
Around Line 110 (Emacs>Alt-GG) is this block:
<IfModule php5_module> php_admin_value open_basedir "/var/www/virtual/joel.co.in/:/var/www/virtual/joel.co.in/phptmp/:/usr/share/php:/usr/share/pear/" php_admin_value upload_tmp_dir "/var/www/virtual/joel.co.in/phptmp/" php_admin_value session.save_path "/var/www/virtual/joel.co.in/phptmp/" php_admin_value sendmail_path "/usr/sbin/sendmail -f [email protected] -t -i" # Custom values php_admin_value max_execution_time 30 php_admin_value max_input_time 60 php_admin_value memory_limit "128M" php_value error_reporting 30711 php_flag display_errors off php_admin_value post_max_size "10M" php_admin_value upload_max_filesize "10M" php_admin_flag allow_url_fopen off </IfModule>
I changed that line
php_admin_value max_execution_time 30
from 30 to 70, and Voila! It was reflected in the phpinfo!
For my Debian server,
Master value: /etc/php5/apache2/php.ini Local value: /etc/apache2/sites-enabled/joel.co.in.conf
The second time I reinstalled the server these files were absent. I had to:
chmod u=rw ./var/www/fcgi/joel.co.in/php5/php.ini grep -in 'phpinfo' ./var/www/fcgi/joel.co.in/php5/php.ini 385:disable_functions = show_source,system,shell_exec,passthru,exec,phpinfo,shell,symlink [[email protected]] / #emacs ./var/www/fcgi/joel.co.in/php5/php.ini [[email protected]] / #service apache2 restart
Setting Timezone for the server:
There are two settings to be done, one for the server, and another for php.
For the server:
[email protected]:/etc# grep -ni 'date\.timezone' ./php5/apache2/php.ini 947:; http://php.net/date.timezone 948:date.timezone = Europe/Moscow
Change Europe/Moscow to Asia/Kolkata.
Now phpinfo will show the correct timezone.
Setting up key based authentication
When I login to the VPS, I am asked for a password and dropped into /root. openssh seems to have been already installed.
So, I have to create a folder to hold my keys.
First I need to see the default location and modify it if necessary.
[email protected]:~# grep -i 'AuthorizedKeysFile' /etc/ssh/sshd_config #AuthorizedKeysFile %h/.ssh/authorized_keys
All’s well. Apparently by default openssh is setup to read keys from the user’s home directory, from the .ssh subfolder.
So create this folder and assign permissions to it:
cd $HOME mkdir .ssh chmod 700 ~/.ssh
Now, from your PC, transfer your public and private keys to the server with scp, using your password and root as username.
Once done, `cat` the public key, and add it to a new text file ~/.ssh/authorized_keys
Save the file.
Restart openssh service. Now you will be able to connect without password (or using the key’s password)
service ssh restart
(Apparent) Error noticed after installing i-mscp:
php5 module seemed to be removed/not installed automatically. I had to :
apt-get install libapache2-mod-php5 service apache2 restart[/code] for it to work properly. But once php5 module is installed, php starts working, but i-mscp control panel gets an error and stops loading. All this seems weird. Edit: Apparently I was wrong. phpinfo had been disabled in imscp due to security reasons. Install Locales:aptitude install locales-all dpkg-reconfigure locales
Setting up DNS:
Edit /etc/resolv.conf and add the following line to the top:nameserver 184.108.40.206 nameserver 220.127.116.11
You can replace these by your favorite DNS resolver.
Cannot receive email on ispcp (VPS)
The error message noted was:
"Delivery to following recipient failed [email protected] User unknown in local recipient table"
This was due to improperly configured hostname, and existence of sendmail
Remove sendmail:aptitude search sendmail aptitude purge sendmail-base sendmail-cf sendmail-doc
Confirm with:netstat -plunt
or:netstat -lpn | grep 'sendmail'
Setting both local hostname and imscp hostname fixed it.perl imscp-autoinstall -sdr hostname
should be done to make sure the imscp hostname is set to be the same as the result of hostname -f
The server hostname defined in /etc/imscp/imscp.conf should be same as the actual hostname as defined in:[email protected]:~# hostname -f r2d2.joel.co.in
[email protected]:~# cat /etc/hostname
Note that /etc/hostname is actually the prefix of server (not fully qualified domain name).
In addition there should be an MX record pointing to correct hostname to the IP, and an A record for the same;; QUESTION SECTION: ;joel.co.in. IN MX ;; ANSWER SECTION: joel.co.in. 14400 IN MX 10 r2d2.joel.co.in. ;; AUTHORITY SECTION: joel.co.in. 294262 IN NS ns101.dnsever.com. joel.co.in. 294262 IN NS ns108.dnsever.com. joel.co.in. 294262 IN NS ns77.dnsever.com. ;; ADDITIONAL SECTION: r2d2.joel.co.in. 14400 IN A 18.104.22.168 ns101.dnsever.com. 3166 IN A 22.214.171.124 ns108.dnsever.com. 3166 IN A 126.96.36.199
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.