lighttpd は、ロボットのHTTP通信で使っている
なんといっても軽量で早い
これはでは、一度 aptでインストールしてから、上書きしていたけど、
最初から、最新版のインストールしちゃう手順。
まぁ、シェル化すればいいんだけど、それは今度
手順は、下に記述しました。
Peace!!
#-----------------------------------------------------------
#step1 install
#-----------------------------------------------------------
mkdir tmp
cd tmp
wget https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.53.tar.gz
tar xvf lighttpd-1.4.53.tar.gz
cd lighttpd-1.4.53
sudo apt-get -y install libpcre3-dev bzip2 libbz2-dev
./configure
make
sudo make install
sudo ldconfig
#-----------------------------------------------------------
# step2 systemd
#-----------------------------------------------------------
which lighttpd
sudo cp doc/systemd/lighttpd.service /lib/systemd/system
sudo vi /lib/systemd/system/lighttpd.service
# change /usr/sbin/lighttpd -> /usr/local/sbin/lighttpd
sudo systemctl enable lighttpd.service
#-----------------------------------------------------------
# step3 /etc/lighttpd
#-----------------------------------------------------------
sudo mkdir /etc/lighttpd
sudo cp doc/config/lighttpd.conf /etc/lighttpd
sudo cp doc/config/modules.conf /etc/lighttpd
sudo cp -r doc/config/conf.d /etc/lighttpd
cd /etc/lighttpd
sudo vi lighttpd.conf
var.server_root = "/var/www"
#server.use-ipv6 = "enable"
server.username = "www-data"
server.groupname = "www-data"
#server.document-root = server_root + "/htdocs"
server.document-root = server_root
sudo vi modules.conf
"mod_alias"
include "conf.d/cgi.conf"
sudo vi conf.d/cgi.conf
#######################################################################
##
## CGI modules
## ---------------
##
## See https://redmine.lighttpd.net/projects/lighttpd/wiki/docs_modcgi
##
server.modules += ( "mod_cgi" )
##
## Plain old CGI handling
##
## For PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini.
##
#cgi.assign = ( ".pl" => "/usr/bin/perl",
# ".cgi" => "/usr/bin/perl",
# ".rb" => "/usr/bin/ruby",
# ".erb" => "/usr/bin/eruby",
# ".py" => "/usr/bin/python" )
#
##
## to get the old cgi-bin behavior of apache
##
## Note: make sure that mod_alias is loaded if you uncomment the
## next line. (see modules.conf)
##
#alias.url += ( "/cgi-bin" => server_root + "/cgi-bin" )
alias.url += ( "/api" => server_root + "/api" )
$HTTP["url"] =~ "^/api" {
cgi.assign = ( "" => "" )
}
##
#######################################################################
#-----------------------------------------------------------
# step4 /var/www /var/log/lighttpd /var/run/lighttpd.pid
#-----------------------------------------------------------
sudo mkdir /var/www
sudo mkdir /var/www/api
cd /var/www
sudo vi index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>lighttpd alive</title>
</head>
<body>
<p>lighttpd server success/p>
</body>
</html>
sudo chown -R www-data:www-data /var/www
sudo mkdir /var/log/lighttpd
sudo chown -R www-data:www-data /var/log/lighttpd
sudo touch /var/run/lighttpd.pid
sudo chown www-data:www-data /var/run/lighttpd.pid
sudo systemctl start lighttpd
#-----------------------------------------------------------
# step5 cgi
#-----------------------------------------------------------
cd /var/www/api
sudo vi test.c
#include <stdio.h>
void main(){
printf("Content-type: text/plain\n\n");
printf("Hello, World!");
return;
}
sudo gcc test.c -o test
//EOF