Difference between revisions of "Installing a webserver on AXIOM Beta"

From apertus wiki
Jump to: navigation, search
Line 23: Line 23:


and place the following content in the file:
and place the following content in the file:
  server.modules += ( "mod_cgi" )
  <nowiki>server.modules += ( "mod_cgi" )


  cgi.assign                = ( ".pl"  => "/usr/bin/perl",
  cgi.assign                = ( ".pl"  => "/usr/bin/perl",
Line 36: Line 36:
                               "index.erb",  "default.erb",
                               "index.erb",  "default.erb",
                               "index.py",  "default.py",
                               "index.py",  "default.py",
                               "index.php",  "default.php" )
                               "index.php",  "default.php" )</nowiki>


For PHP scripts you will need to make sure the following is set in /etc/php/php.ini
For PHP scripts you will need to make sure the following is set in /etc/php/php.ini
Line 45: Line 45:


  include "conf.d/cgi.conf"
  include "conf.d/cgi.conf"
Create a new configuration file /etc/lighttpd/conf.d/fastcgi.conf
<nowiki># Make sure to install php and php-cgi. See:                                                           
# https://wiki.archlinux.org/index.php/Fastcgi_and_lighttpd#PHP
server.modules += ("mod_fastcgi")
# FCGI server
# ===========
#
# Configure a FastCGI server which handles PHP requests.
#
index-file.names += ("index.php")
fastcgi.server = (
    # Load-balance requests for this path...
    ".php" => (
        # ... among the following FastCGI servers. The string naming each
        # server is just a label used in the logs to identify the server.
        "localhost" => (
            "bin-path" => "/usr/bin/php-cgi",
            "socket" => "/tmp/php-fastcgi.sock",
            # breaks SCRIPT_FILENAME in a way that PHP can extract PATH_INFO
            # from it
            "broken-scriptfilename" => "enable",
            # Launch (max-procs + (max-procs * PHP_FCGI_CHILDREN)) procs, where
            # max-procs are "watchers" and the rest are "workers". See:
            # https://redmine.lighttpd.net/projects/1/wiki/frequentlyaskedquestions#How-many-php-CGI-processes-will-lighttpd-spawn
            "max-procs" => 4, # default value
            "bin-environment" => (
                "PHP_FCGI_CHILDREN" => "1" # default value
            )
        )
    ) 
)</nowiki>
Make lighttpd use the new configuration file /etc/lighttpd/lighttpd.conf
include "conf.d/fastcgi.conf"

Revision as of 18:58, 13 August 2016

1 Installing required packages

Make sure the AXIOM Beta is connected to the internet and then on the commandline run:

Update mirrors database:

pacman -Syy

Install webserver:

pacman -S lighttpd php php-cgi

start the webservice:

systemctl start lighttpd

write any pending changes to the file system:

sync

2 Configure Webserver

This is following the guide from the lighttpd archlinux wiki page: https://wiki.archlinux.org/index.php/lighttpd

mkdir /etc/lighttpd/conf.d/
nano /etc/lighttpd/conf.d/cgi.conf

and place the following content in the file:

server.modules += ( "mod_cgi" )

 cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
                               ".cgi" => "/usr/bin/perl",
                               ".rb"  => "/usr/bin/ruby",
                               ".erb" => "/usr/bin/eruby",
                               ".py"  => "/usr/bin/python",
                               ".php" => "/usr/bin/php-cgi" )

 index-file.names           += ( "index.pl",   "default.pl",
                               "index.rb",   "default.rb",
                               "index.erb",  "default.erb",
                               "index.py",   "default.py",
                               "index.php",  "default.php" )

For PHP scripts you will need to make sure the following is set in /etc/php/php.ini

cgi.fix_pathinfo = 1

In your Lighttpd configuration file, /etc/lighttpd/lighttpd.conf add:

include "conf.d/cgi.conf"

Create a new configuration file /etc/lighttpd/conf.d/fastcgi.conf

# Make sure to install php and php-cgi. See:                                                             
# https://wiki.archlinux.org/index.php/Fastcgi_and_lighttpd#PHP

server.modules += ("mod_fastcgi")

# FCGI server
# ===========
#
# Configure a FastCGI server which handles PHP requests.
#
index-file.names += ("index.php")
fastcgi.server = ( 
    # Load-balance requests for this path...
    ".php" => (
        # ... among the following FastCGI servers. The string naming each
        # server is just a label used in the logs to identify the server.
        "localhost" => ( 
            "bin-path" => "/usr/bin/php-cgi",
            "socket" => "/tmp/php-fastcgi.sock",
            # breaks SCRIPT_FILENAME in a way that PHP can extract PATH_INFO
            # from it 
            "broken-scriptfilename" => "enable",
            # Launch (max-procs + (max-procs * PHP_FCGI_CHILDREN)) procs, where
            # max-procs are "watchers" and the rest are "workers". See:
            # https://redmine.lighttpd.net/projects/1/wiki/frequentlyaskedquestions#How-many-php-CGI-processes-will-lighttpd-spawn 
            "max-procs" => 4, # default value
            "bin-environment" => (
                "PHP_FCGI_CHILDREN" => "1" # default value
            )
        )
    )   
)

Make lighttpd use the new configuration file /etc/lighttpd/lighttpd.conf

include "conf.d/fastcgi.conf"