General Strategy
The following actions must be taken for WebMO to run cgi scripts written in perl under suexec:
- Apache (or httpd), suexec, and perl must be installed
- Web directories must be created and have the correct permissions
- Apache must be configured to access ~/public_html directories
- Apache must be configured to accept REST methods (WebMO Enterprise)
- Apache must be configured to run cgi scripts in ~/public_html/cgi-bin
- Apache must be restarted to recognize configuration changes
- Optionally, a shortcut for ~/webmo can be made to point to the WebMO login page
Specific instructions are given for a variety of Linux distributions below.
One might also choose to enable both http and https and then redirect all http requests over https. Consult various web resources for doing so.
The server's firewall must allow access via http (port80) and https (port 443) from the desired IP address range. Verify that one can view the server's home or test page.
CentOS 6, 7 or 8
- Disable SELinux
# cd /etc/selinux
# vi config
change "SELINUX=enforcing" to "SELINUX=permissive"
# setenforce 0 - Install apache and perl
# yum install httpd perl perl-CGI
- Create directory structure within user account (/home/smith) and set permissions
# su - smith
$ cd ~
$ chmod 711 ~
$ mkdir public_html
$ chmod 755 public_html
$ cd public_html
$ mkdir cgi-bin
$ chmod 755 cgi-bin
$ exit - Start apache (CentOS 6)
# chkconfig --add httpd
# service httpd start
or start apache (CentOS 7, 8)
# systemctl enable httpd
# systemctl start httpd - Edit /etc/httpd/conf/httpd.conf (CentOS 6) or /etc/httpd/conf.d/userdir.conf (CentOS 7, 8)
Comment out disabling of user directories:
#UserDir disabled
Uncomment the use of public_html:
UserDir public_html
Uncomment the entire <Directory /home/*/public_html> section (CentOS 6):
<Directory /home/*/public_html>
...
</Directory>
Edit the <Directory /home/*/public_html> section as follows (WebMO Enterprise):
AllowOverride FileInfo AuthConfig Limit
Options MultiViews SymLinksIfOwnerMatch IncludesNoExec
Require method GET POST OPTIONS PUT DELETE PATCH
Create an entry for cgi scripts within the user directories by adding the following at the end:
<Directory /home/*/public_html/cgi-bin>
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>
Optionally, redirect access to <ip>/webmo to login page by adding the following at the end:
RedirectMatch ^/webmo(()|/)$ /~smith/cgi-bin/webmo/login.cgi
- Restart apache (CentOS 6)
# service httpd restart
or restart apache (CentOS 7, 8)
# systemctl restart httpd
Debian 7 or 8
- Install apache, suexec, and perl
# apt-get install apache2 apache2-suexec-custom libcgi-pm-perl
- Create directory structure within user account (/home/smith) and set permissions
# su - smith
$ cd ~
$ chmod 711 ~
$ mkdir public_html
$ chmod 755 public_html
$ cd public_html
$ mkdir cgi-bin
$ chmod 755 cgi-bin
$ exit - Start apache
# a2enmod userdir
(Debian 8)
# a2enmod suexec
# a2enmod cgid
# service apache2 start
- Edit /etc/apache2/conf.d/userdir.conf (Debian 7) or /etc/apache2/mods-available/userdir.conf (Debian 8)
Verify that user directories are enabled:
UserDir public_html
UserDir disabled root
Edit the <Directory /home/*/public_html> section to add support for REST methods (WebMO Enterprise):
Require method GET POST OPTIONS PUT DELETE PATCH
Create an entry for cgi scripts within the user directories by adding the following at the end:
<Directory /home/*/public_html/cgi-bin>
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>
Optionally, redirect access to <ip>/webmo to login page by adding the following at the end:
RedirectMatch ^/webmo(()|/)$ /~smith/cgi-bin/webmo/login.cgi
- Restart apache
# service apache2 restart
Ubuntu
- Install apache, suexec, and perl
# apt-get install apache2 apache2-suexec-custom libcgi-pm-perl
- Create directory structure within user account (/home/smith) and set permissions
# su - smith
$ cd ~
$ chmod 711 ~
$ mkdir public_html
$ chmod 755 public_html
$ cd public_html
$ mkdir cgi-bin
$ chmod 755 cgi-bin
$ exit - Start apache
# a2enmod userdir
# a2enmod suexec
# a2enmod cgid
# service apache2 start - Edit /etc/apache2/mods-available/userdir.conf
Verify that user directories are enabled:
UserDir public_html
UserDir disabled root
Edit the <Directory /home/*/public_html> section to add support for REST methods (WebMO Enterprise):
Require method GET POST OPTIONS PUT DELETE PATCH
Create an entry for cgi scripts within the user directories by adding the following at the end:
<Directory /home/*/public_html/cgi-bin>
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>
Optionally, redirect access to <ip>/webmo to login page by adding the following at the end:
RedirectMatch ^/webmo(()|/)$ /~smith/cgi-bin/webmo/login.cgi
- Restart apache
# service apache2 restart
SuSE 11
- Install apache and perl
Perform a normal installation, but add "Web and LAMP server" - Start apache
# /sbin/chkconfig apache2 on
# /sbin/service apache2 start - Edit /etc/apache2/mod_userdir.conf
Verify that user directories are enabled:
UserDir public_html
UserDir disabled root
Edit the <Directory /home/*/public_html> section to add support for REST methods (WebMO Enterprise):
Require method GET POST OPTIONS PUT DELETE PATCH
Create an entry for cgi scripts within the user directories by adding the following at the end:
<Directory /home/*/public_html/cgi-bin>
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>
Optionally, redirect access to <ip>/webmo to login page by adding the following at the end:
RedirectMatch ^/webmo(()|/)$ /~smith/cgi-bin/webmo/login.cgi
- Enable suexec2
# chmod 4555 /usr/sbin/suexec2
- Restart apache
# /sbin/service apache2 restart
Windows and OSX
For Windows or Apple OS X computers, instructions are provided for running CGI scripts on their webservers.