Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794
{"id":2954,"date":"2019-12-27T07:43:58","date_gmt":"2019-12-27T07:43:58","guid":{"rendered":"https:\/\/support.aklwebhost.com\/?post_type=manual_kb&p=2954"},"modified":"2019-12-27T07:43:58","modified_gmt":"2019-12-27T07:43:58","slug":"install-lighttpd-and-php-on-ubuntu","status":"publish","type":"manual_kb","link":"https:\/\/support.aklwebhost.com\/knowledgebase\/install-lighttpd-and-php-on-ubuntu\/","title":{"rendered":"Install Lighttpd and PHP on Ubuntu"},"content":{"rendered":"

Lighttpd is an easy, fast, and flexible web-server that runs on low-resources (CPU\/RAM) while running on a small server. In this tutorial, I will show how to configure lighttpd with PHP to work on multiple sub-domains by using virtual hosts.<\/p>\n

These steps were tested on Ubuntu server.<\/p>\n

Install software<\/h3>\n

Update the server to the latest packages\/updates.<\/p>\n

apt-get update\r\n<\/code><\/pre>\n

Install lighttpd and PHP.<\/p>\n

sudo apt-get install lighttpd php5-cgi\r\n<\/code><\/pre>\n

Enable the fastcgi module and fastcgi PHP support.<\/p>\n

sudo lighty-enable-mod fastcgi \r\nsudo lighty-enable-mod fastcgi-php\r\n<\/code><\/pre>\n

Restart your lighttpd service to apply the fastcgi changes.<\/p>\n

sudo service lighttpd force-reload\r\n<\/code><\/pre>\n

Configure your website<\/h3>\n

On your server, edit the\u00a0\/etc\/lighttpd\/lighttpd.conf<\/code>\u00a0file. Some admins prefer uploading a configuration file over FTP instead of SSH editing.<\/p>\n

vi \/etc\/lighttpd\/lighttpd.conf\r\n<\/code><\/pre>\n
Setup the document root<\/h6>\n

By default, the document root is\u00a0\/var\/www<\/code>. You may prefer to host your sites out of a different folder, such as\u00a0\/var\/websites<\/code>.<\/p>\n

#change\r\nserver.document-root        = \"\/var\/www\"\r\n#to\r\nserver.document-root        = \"\/var\/websites\/root\"\r\n<\/code><\/pre>\n

Note that lighttpd disables the directory listing by default.<\/p>\n

Add virtual hosts<\/h6>\n

Add the following to\u00a0lighttpd.conf<\/code>\u00a0to host a domain or subdomain.<\/p>\n

$HTTP[\"host\"] =~ \"^mydomain\\.com$\" {\r\nserver.document-root = \"\/var\/websites\/domain\"\r\n}\r\n\r\n#or\r\n\r\n$HTTP[\"host\"] =~ \"^sub\\.mydomain\\.com$\" {\r\nserver.document-root = \"\/var\/websites\/domain\/sub\"\r\n}\r\n<\/code><\/pre>\n

Bare in mind that the\u00a0$HTTP<\/strong>\u00a0line contains a regular expression between quotation marks.<\/p>\n

If you would like to disable directory listings for virtual hosts, use the following example.<\/p>\n

$HTTP[\"host\"] =~ \"^sub\\.mydomain\\.com$\" {\r\nserver.document-root = \"\/var\/websites\/domain\/sub\"\r\ndir-listing.activate = \"disable\"\r\n}\r\n<\/code><\/pre>\n
Save and restart<\/h6>\n

Once you have finished adding virtual hosts, save the\u00a0lighttpd.conf<\/code>\u00a0file and restart the lighttpd service.<\/p>\n

service lighttpd restart\r\n<\/code><\/pre>\n

At this point, lighttpd is serving your PHP pages. Enjoy!<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[109,242,247],"manual_kb_tag":[473],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2954"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=2954"}],"version-history":[{"count":1,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2954\/revisions"}],"predecessor-version":[{"id":2955,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2954\/revisions\/2955"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=2954"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=2954"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=2954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}