1

Topic: help required adding website to apache2

==== Provide required information ====
- iRedMail version and backend (LDAP/MySQL/PGSQL): 0.7.4 LDAP
- Linux/BSD distribution name and version: Ubuntu server 11.10
- Any related log? Log is helpful for troubleshooting.
====

Please help.
I am very new to linux and have chossen Ubuntu as my migration from the Microsoft world.
I have installed and was happily using iRedMail on my Ubuntu server 11.10 when I decided I wanted to host my website on the same server.
I read a number of articles about hosting additional sites on apache2 and it seemed fairly simple.
I followed a process of copying the /etc/apache2/sites-available/default file and modifying the new one for my website.
Everything seemed to go OK when I enabled the site with the a2ensite command.
I restarted the apache2 service, no problems.
I tried to visit my website and got a 404 error.
I tried to visit the iRedMail admin web page and the phpLDAP web page both fail with IE cannot display webpage.
It seems there is also an issue with the SSL certificate.

Please help

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: help required adding website to apache2

kh wrote:

I tried to visit my website and got a 404 error.
I tried to visit the iRedMail admin web page and the phpLDAP web page both fail with IE cannot display webpage.

- Make sure you have correct DocumentRoot in your virtual host config file (/etc/apache2/sites-available/[SITE_CONFIG]).
- Do you create directory alias for iRedAdmin and phpLDAPadmin? just like /etc/apache2/conf.d/iredadmin.conf, phpldapadmin.conf.

3

Re: help required adding website to apache2

I'm fairly sure I got the DocumentRoot correct in my /etc/apache2/sites-available/mysite
As a test I deleted the mysite file and the iRedMail websites all work ok again.
Do I need to create the /etc/apache2/conf.d/mysite.conf file instead?
Do you have a step through (for noobies like me) to add a website to apache2 in Ubuntu server so that I don't make anymore silly mistakes and mess up my iRedMail installation?

4

Re: help required adding website to apache2

Do you have alias settings for iRedAdmin/phpLDAPadmin in your virtual host config? Refer to /etc/apache2/conf.d/iredadmin.conf, phpldapadmin.conf for reference.

5

Re: help required adding website to apache2

I'm not sure what your asking for, so here are the following configs and what I did next

/etc/apache2/conf.d/iredadmin.conf

WSGISocketPrefix /var/run/wsgi
WSGIDaemonProcess iredadmin user=iredadmin threads=15
WSGIProcessGroup iredadmin

AddType text/html .py

<Directory /usr/share/apache2/iredadmin/>
    Order allow,deny
    Allow from all
</Directory>



/etc/apache2/sites-available/default

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

I copied the sites-available/default
called it mywebsite
changed the DocumentRoot and Directory entries to the path of mywebsite
then ran a2ensite mywebsite

6

Re: help required adding website to apache2

Dear kh, please show us the virtual host config file of "mywebsite".
I guess you don't have Alias setting for iRedAdmin and phpLDAPadmin in "mywebsite".

7

Re: help required adding website to apache2

/etc/apache2/sites-available/mywebsite

<VirtualHost *>
        ServerAdmin xxxxxxxxx@xxxxxxxxxx.co.uk   #my email address

        DocumentRoot /home/user/websites/mywebsite/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /home/user/websites/mywebsite/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

8

Re: help required adding website to apache2

Add below lines in /etc/apache2/sites-available/mywebsite, before </VirtualHost>

Alias /iredadmin/static "/usr/share/apache2/iredadmin/static/"
WSGIScriptAlias /iredadmin "/usr/share/apache2/iredadmin/iredadmin.py/"

9

Re: help required adding website to apache2

Hi evry body,
I have the same problem like kh. I just added the two lines in /etc/apache2/sites-available/mywebsite, and, after reloading apache when i try to access mywebsite it redirect to host.mydomain.tld/mail. I have exactly the same config as kh. Thank you for your help.

Note: sorry for my bad english....

10

Re: help required adding website to apache2

Sorry to say I am still having problems.
Adding the 2 lines has taken me one step further - the iredadmin (and other) webpages work fine.
But when I htt*://myserver/mywebsite/ I get a 404 error.

Could it be that I have put the mywebsite files in /home/user/websites/mywebsite/
Where should I put the mywebsite files?
Where are the iredadmin etc files?

Thanks for everything so far.

11

Re: help required adding website to apache2

Dear kh,

You need a "ServerName" setting in your virtual host config file, e.g. "ServerName mywebsite.com", then you can access this site via htt*://mywebsite.com/ if you have correct DNS record for mywebsite.com.

Reference: http://httpd.apache.org/docs/2.2/vhosts/