博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
INSTALLING LIGHTTPD on CentOS 6.2
阅读量:5971 次
发布时间:2019-06-19

本文共 3573 字,大约阅读时间需要 11 分钟。

hot3.png

** lighttpd_logo Here is a simple guide to set up a working LIGHTTPD web server on CentOS 6.2 server. let’s get started.. CONFIGURATION:

Step 1: make sure you have connectivity! And DNS resolution!

[root@localhost]# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=45 time=45.9 ms

[root@localhost]# ping www.google.it PING www-cctld.l.google.com (173.194.35.151) 56(84) bytes of data. 64 bytes from muc03s01-in-f23.1e100.net (173.194.35.151): icmp_seq=1 ttl=51 time=48.9 ms

Step 2: install the packages ZLIB data compression library and PCRE “Perl-compatible regular expression library”

[root@localhost]# yum install zlib zlib-devel pcre pcre-devel

Add the repository with the following:

rpm -Uhv

Install Lighty!

Yum install lighttpd

Set boot properties

Chkconfig –levels 235 lighttpd on

And start the service

Service lighttpd start

!! IF ERROR COMES UP !! like this one:

Starting lighttpd: XX:DATE:XX:TIME:XX: (server.c.722) couldn't set 'max filedescriptors' Permission denied [FAILED]

Correct doing the following :

[root@localhost]# yum install policycoreutils-python

[root@localhost]# semodule -DB [root@localhost]# /etc/init.d/auditd restart Stopping auditd:[ OK ] Starting auditd:[ OK ] [root@localhost]# /etc/init.d/lighttpd restart Stopping lighttpd:[FAILED] Starting lighttpd: XX:DATE:XX:TIME:XX: (server.c.722) couldn't set 'max filedescriptors' Permission denied [FAILED] [root@localhost]# grep lighttpd /var/log/audit/audit.log | audit2allow -M lighttpdmaxfds [root@localhost]# semodule -i lighttpdmaxfds.pp [root@localhost]# /etc/init.d/lighttpd start Starting lighttpd:[ OK ] [root@localhost]# /usr/sbin/semodule –B

Ok now Lighttpd is up & running, let’s see the main directories: Web pages document root: /srv/www/lighttpd/ Config file: /etc/lighttpd/lighttpd.conf Module library: /usr/lib/lighttpd/ Log files: /var/log/lighttpd/ Save default configuration:

[root@localhost lighttpd]# cp lighttpd.conf lighttpd.def.conf [root@localhost lighttpd]# cp modules.conf modules.def.conf [root@localhost lighttpd]# Nano modules.conf

server.modules = (  "mod_access",#  "mod_alias",#  "mod_auth",#  "mod_evasive",#  "mod_redirect",#  "mod_rewrite",#  "mod_setenv",#  "mod_usertrack",  "mod_accesslog"   )     ## <-- add this line”

Step into lighttpd.conf file and modify this lines (open with nano and just hit ctrl+w to search in the file) (install nano editor with yum install nano if nano is not present)

server.port = 3000 server.pid-file = "/var/run/lighttpd.pid"

server.document-root = "/srv/www/lighttpd/"

server.errorlog = "/var/log/lighttpd/error_log"

make sure this lines are present (or modify with your needs)

index-file.names = ( "index.html", "index.htm", "default.htm" ) static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", "~", ".inc" )

go to /conf.d folder and modify access_log.conf with the following line:

accesslog.filename = "/var/log/lighttpd/access_log"

Check syntax, restart the service and write a simple “hello world” index file:

[root@localhost lighttpd]# lighttpd -t -f lighttpd.conf Syntax OK

[root@localhost lighttpd]# service lighttpd start Starting lighttpd: [ OK ] [root@localhost lighttpd]# service lighttpd restart Stopping lighttpd: [ OK ] Starting lighttpd: [ OK ]

[root@localhost lighttpd]# cd /srv/www/lighttpd/ [root@localhost lighttpd]# ls [root@localhost lighttpd]# nano index.html Hello World!

^X y

[root@localhost lighttpd]#

Now navigate to the webserver IP with any browser you should able to see the message. Thanks.**

转载于:https://my.oschina.net/u/1176559/blog/602610

你可能感兴趣的文章
iOS边练边学--介绍布局的三种方法
查看>>
[React] React Router: Nested Routes
查看>>
android: 播放视频
查看>>
Redis 学习(一)
查看>>
Terraform入门 - 3. 变更基础设施
查看>>
前端开发模式--MV*
查看>>
PAT A1048 二分/two points
查看>>
Python2+Selenium入门05-关于WebElement类
查看>>
后端_ThinkPHP5
查看>>
JS中数据类型、内置对象、包装类型对象、typeof关系
查看>>
Redis | 001能做什么?
查看>>
vue+node全栈移动商城【11】连接mongodb并存入数据
查看>>
从 egg-bin 聊到 command line interface Tool
查看>>
图像搜索技术发展应知道
查看>>
React16性能改善的原理一
查看>>
【跃迁之路】【720天】程序员高效学习方法论探索系列(实验阶段477-2019.2.10)...
查看>>
扩展Spring Cloud Feign 实现自动降级
查看>>
代码片段
查看>>
jsonp跨域资源引起CORB
查看>>
鼠标右键兼容MAC版火狐浏览器
查看>>