Posts Tagged ‘ISPConfig 3’

How to reset the MySQL root password

Wednesday, October 21, 2009 posted by Till

The following steps describe the procedure to reset the mysql root password on Linux.

1) Stop the mysql server

/etc/init.d/mysql stop

2) Start the mysql server manually without permission tables which allows us to login as root user without password:

mysqld_safe --skip-grant-tables &

3) Login into mysql as root user without a password and switch to the “mysql” database:

mysql -u root mysql

Then execute this SQL query to set a new password for the mysql root user:

update user set Password=PASSWORD('mynewpassword') WHERE User='root';

(Replace “mynewpassword” with the new root password in the above command).

Then logout from the mysql prompt by typing:

exit

4) Now bring back the running mysql instance into the foreground by typing:

fg

and then press [ctrl] + c to kill the mysql process.

5) Start the mysql server again:

/etc/init.d/mysql start

How to use a custom php.ini with suphp

Monday, October 19, 2009 posted by Till

To use a custom php.ini file with SuPHP for a website, you can define the path to the php.ini file in a .htaccess file or in the apache vhost like this:

suPHP_ConfigPath /home/websites/domain.tld/

Then add a php.ini file in the directory /home/websites/domain.tld/ which may be a copy of the global php.ini were you just changed a few settings or an empty file were you add only the settings that shall be overridden in the global PHP configuration.

If you use ISPConfig 2 or 3, you can add the suPHP_ConfigPath setting also in the apache directives field of the website  in ISPConfig.

If you want to redirect a subdomain like sub.domain.tld into a subdirectory of the website and keep the original URL in the browser location bar, you may use the following apache directives.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.domain.tld [NC]
RewriteRule ^/(.*)$ /sub/$1 [L]

This rewrite rule can be added into a .htaccess file in the website root or inside the vhost file. If you use ISPConfig 2 or 3, you can add this also into the apache directives field in the website settings.

Replace sub.domain.tld with the subdomain that shall be redirected and /sub/ with the path to the directory were the pages for this subdomain are located.

If all your visitors shall access your website with a URL like www.domain.com and not without www, use the following apache rewrite rule for redirecting them.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www
RewriteRule (.*) http://www.%{HTTP_HOST}$1 [L,R]

The apache rewrite rule can be added in a .htaccess file in the website root directory or if you use ISPConfig 2 or 3, you can also add the rwrite rule into the apache directives field of the website.

If you run a firewall on your Linux server and want to use passive FTP connections, you have to define the passive port range in pure-ftpd and your firewall to ensure that the connections dont get blocked. The following example is for pure-ftpd on Debian or Ubuntu Linux and ISPConfig 3:

1) Configure pure-ftpd

echo "40110 40210" > /etc/pure-ftpd/conf/PassivePortRange /etc/init.d/pure-ftpd-mysql restart


2) Configure the firewall. If you use ISPConfig 3 on my server to configure the bastille firewall, you can add the nescessera port range in the ISPConfig firewall settings.

Change the list of Open TCP ports from:

20,21,22,25,53,80,110,143,443,3306,8080,10000


to:

20,21,22,25,53,80,110,143,443,3306,8080,10000,40110:40210


and then click on “Save”.

Http connections can be redirected to https with the apache mod_rewrite module, which should be available in every apache installation. Create a file with the name .htaccess in the website root directory which contains the following lines:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

If you use ISPConfig 2 or 3, you can add these lines also in the apache directives field of  the website settings form instead of adding them to a .htaccess file. But the approach with the .htaccess file will work on ISPConfig as well.

Is there a recommended Linux distribution for ISPConfig 3?

Monday, October 5, 2009 posted by Till

ISPconfig 3 is developed on Debian Linux, this means that Debian is the most tested Linux distribution for ISPConfig. Additionally, Debian has almost all required software packages for ISPConfig in its main repositories without the need to compile them manually and Debian has proven to be very stable in Server enviroments.

This leads to my personal recommendation to use Debian Linux for ISPConfig.

Install postfix with MySQL support on CentOS 5.3 (64Bit)

Monday, September 21, 2009 posted by Till

The following article explains the steps to compile postfix MTA with MySQL support on CentOS 5.3 as e.g. needed for ISPConfig 3.

Remove the postfix package from CentOS which does not has MySQL support:

/etc/init.d/postfix stop rpm -e --nodeps postfix


Download the postfix source RPM and install it:

cd /tmp wget http://mirror.rackspace.com/CentOS/5.3/os/SRPMS/postfix-2.3.3-2.1.el5_2.src.rpm rpm -i postfix-2.3.3-2.1.el5_2.src.rpm


Edit the spec file to enable MySQL support.

vi /usr/src/redhat/SPECS/postfix.spec


and change the line:

%define MYSQL 0


to:

%define MYSQL 1


Install a few prerequisites before we build the new postfix RPM package

yum install pcre-devel mysql-devel


Build the postfix RPM with MySQL support:

rpmbuild -ba /usr/src/redhat/SPECS/postfix.spec


and install it.

cd /usr/src/redhat/RPMS/x86_64 rpm -i postfix-2.3.3-2.1.x86_64.rpm


Start postfix and configure it to be started at boot time:

/etc/init.d/postfix start chkconfig --levels 235 postfix on

The language of the generated webslizer statistics is statically compiled into the webalizer binary. To change the language, webalizer has to be recompiled. In the following example, I will recompile webalizer to change the language to german.

Uninstall webalizer and install the GD library:

apt-get remove webalizer apt-get install libgd2-xpm-dev Download the latest webalizer sources and uncompress the tar archive: <p class="command">cd /tmp wget <a href="http://archive.mgm51.com/mirrors/webalizer-files/webalizer-2.01-10-src.tgz">http://archive.mgm51.com/mirrors/webalizer-files/webalizer-2.01-10-src.tgz</a> tar xzf webalizer-2.01-10-src.tgz cd webalizer-2.01-10 Reconfigure and compile webalizer <p class="command">./configure --with-language=german make make install Create a symlink so that other applications find the webalizer binary in the common place <p class="command">ln -s /usr/local/bin/webalizer /usr/bin/webalizer

Cleanup

rm -f /tmp/webalizer-2.01-10-src.tgz
rm -rf /tmp/webalizer-2.01-10

Thanks to planet_fox for this FAQ.

The pure-ftp daemon by default has a recursion limit of 2000 files, this prevents the server from showing more then 2000 files when you browse a directory with a FTP client. To expand this Limit to e.g 5000 files, create or edit the file /etc/pure-ftpd/conf/LimitRecursion and add a line “5000 500″:

echo "5000 500" &gt; /etc/pure-ftpd/conf/LimitRecursion

and then restart pureftpd:

/etc/init.d/pure-ftpd-mysql restart