Skip to content
Project httpsrv 2.0 – Script to compile, install and manage on DEB/RPM based Linux
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.




Httpsrv Video:
Chroot Video:

Easy to use script to compile and install Apache2 and PHP7 from Source
This script will also help you manage the service, stare/stop/restart etc.

I take no responsibility for this script, use at your own risk
Security and bugs shall be reported to apache php or mysql
This script is only tested with softwareversions found in
The script is only tested with: CentOS6, CentOS7 and Ubuntu 16.04 Linux


License MIT:


1. Install dependencies and other software (Copy and paste one line at a time)

	apt-get install libpcre3-dev libbz2-dev libfreetype6-dev libicu-dev g++ libxslt-dev -y
	apt-get install gcc make nano libjpeg-dev libpng-dev libxml2-dev libcurl4-openssl-dev -y
	apt-get install libssl-dev libmcrypt-dev libreadline-dev pkg-config unzip wget -y

	yum install gcc make openssl-devel nano epel-release libjpeg-devel libpng-devel lynx -y
	yum install libxml2-devel libcurl-devel libmcrypt-devel readline-devel freetype-devel -y
	yum install bzip2-devel libicu-devel pcre-devel gcc-c++ libxslt-devel unzip wget -y

2. Download and install MySQL

	cd /tmp && wget -O mysql-apt.deb && dpkg -i mysql-apt.deb
	apt-get update && apt-get install mysql-client mysql-server -y
	cd /tmp && wget -O mysql-el6.rpm && rpm -Uvh mysql-el6.rpm
	yum install mysql-community-server -y && service mysqld start && grep 'temporary password' /var/log/mysqld.log

	cd /tmp && wget -O mysql-el7.rpm && rpm -Uvh mysql-el7.rpm
	yum install mysql-community-server -y && service mysqld start && grep 'temporary password' /var/log/mysqld.log
3. Download httpsrv using wget
	cd /tmp && wget
	unzip -d /srv
4. Edit and configure variables in /srv/httpsrv/tmp/
	Uncomment the 'SOCK'-variable depending on system in use
	Ubuntu: #SOCK=/run/mysqld/mysqld.sock => SOCK=/run/mysqld/mysqld.sock
	CentOS: #SOCK=/var/lib/mysql/mysql.sock => SOCK=/var/lib/mysql/mysql.sock
	chmod -R 777 /srv/httpsrv && nano /srv/httpsrv/tmp/

5. configure and build httpsrv, httpd (Apache) + PHP and phpMyAdmin
	/srv/httpsrv/tmp/ web_conf
	/srv/httpsrv/tmp/ web_make
	/srv/httpsrv/tmp/ php_conf
	/srv/httpsrv/tmp/ php_make
	/srv/httpsrv/tmp/ finalize
	mysql -u root -p < /srv/httpsrv/phpmyadmin/sql/create_tables.sql
6. Edit: /srv/httpsrv/conf/httpd.conf:
	Define a new variable called 'root_path' on the row bellow the "ServerRoot" directive
		ServerRoot "/srv/httpsrv"
		Define root_path /srv/httpsrv
7. Edit and change bellow in httpd.conf:
	LoadModule rewrite_module modules/
	User httpsrv
	Group httpsrv
	ServerName httpsrv:80
    # AllowOverride controls what directives may be placed in .htaccess files.
	# This directive is for the directory: /srv/httpsrv/htdocs
    AllowOverride All
	DirectoryIndex index.html index.htm index.php

	AddType application/x-httpd-php .php
	AddType application/x-httpd-php-source .phps

	# Add this line to the bottom of your configuration.
	# Configurationfile for phpmyadmin, aliases and permissions:
	Include conf/extra/phpmyadmin.conf
8. Restart httpsrv and configure autostart:

	update-rc.d init-httpsrv defaults && httpsrv restart

	chkconfig --add init-httpsrv && chkconfig init-httpsrv on && httpsrv restart
More actions in script:
start the webserver
	httpsrv start
stop the webserver
	httpsrv stop
Restart the webserver
	httpsrv restart
Display active processes
	httpsrv stats
Display executabes and there versions
	httpsrv info
Display were configurationfiles are:
	httpsrv conf
Change permissions, owner and group on /srv/httpsrv/htdocs	
	httpsrv perm
Change permissions, owner and group on /srv/httpsrv
	httpsrv perm_all
Validate configurationfile for Apache2 (httpd)
	httpsrv conftest
Create a new empty directory in /srv
	httpsrv update_all
Uninstall and remove /srv/httpsrv
	httpsrv remove_all
You can’t perform that action at this time.