Lighttpd是一款安全,快速,符合标准的Web服务器,专为速度至关重要的环境而设计。 本教程将介绍如何在具有PHP支持(通过PHP-FPM)和MySQL支持的CentOS 7服务器上安装Lighttpd。 PHP-FPM(FastCGI Process Manager)是一种替代的PHP FastCGI实现,具有对任何大小的网站(特别是繁忙的站点)有用的一些附加功能。 我在本教程中使用PHP-FPM,而不是Lighttpd的spawn-fcgi。

1初步说明

在本教程中,我使用IP地址为192.168.1.100的hostname server1.example.com 。 这些设置可能会有所不同,因此您必须在适当的情况下更换它们。

2安装MariaDB作为MySQL代替

首先我们像这样安装MySQL:

yum -y install mariadb mariadb-server

然后,我们为MySQL创建系统启动链接(以便每当系统启动时,MySQL自动启动)并启动MySQL服务器:

systemctl enable  mariadb.service

systemctl start  mariadb.service

为MarisDB根帐户设置密码:

mysql_secure_installation

[root@server1 ~]# mysql_secure_installation

/usr/bin/mysql_secure_installation:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB

SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current

password for the root user. If you've just installed MariaDB, and

you haven't set the root password yet, the password will be blank,

so you should just press enter here.

Enter current password for root (enter for none):

OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB

root user without the proper authorisation.

Set root password? [Y/n]

New password:

Re-enter new password:

Password updated successfully!

Reloading privilege tables..

... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone

to log into MariaDB without having to have a user account created for

them. This is intended only for testing, and to make the installation

go a bit smoother. You should remove them before moving into a

production environment.

Remove anonymous users? [Y/n]

... Success!

Normally, root should only be allowed to connect from 'localhost'. This

ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]

... Success!

By default, MariaDB comes with a database named 'test' that anyone can

access. This is also intended only for testing, and should be removed

before moving into a production environment.

Remove test database and access to it? [Y/n]

- Dropping test database...

... Success!

- Removing privileges on test database...

... Success!

Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

Reload privilege tables now? [Y/n]

... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB

installation should now be secure.

Thanks for using MariaDB!

3安装Lighttpd

由于Lighttpd和PHP-FPM不能从官方CentOS存储库获得,因此我们需要启用EPEL存储库:

yum -y install epel-release

导入EPEL GPG密钥:

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

然后运行:

yum update

之后,我们可以像这样安装Lighttpd:

yum -y install lighttpd

然后我们创建Lighttpd的系统启动链接(以便Lighttpd在系统引导时自动启动)并启动它:

systemctl enable  lighttpd.service

systemctl start  lighttpd.service

如果Lighttpd无法从以下错误消息开始...

(network.c.203) socket failed: Address family not supported by protocol

...打开/etc/lighttpd/lighttpd.conf ...

nano /etc/lighttpd/lighttpd.conf

...并将server.use-ipv6从enable设置为disable :[...]

##

## Use IPv6?

##

server.use-ipv6 = "disable"

[...]

然后尝试再次启动Lighttpd - 它现在应该没有任何问题:

systemctl startlighttpd.service

Lighttpd的文件根目录在/ var / www / htdocs(基本目录/ var / www plus htdocs作为根据lighttpd.conf文件的子目录),但它将默认文件安装到/ var / www / lighttpd。 这是不一致的,所以我们必须重命名这样的目录。

mv /var/www/lighttpd /var/www/htdocs

现在将您的浏览器指向http://192.168.1.100 ,您应该看到以下页面:

Lighttpd的默认文档根目录是/ var / www / htdocs / on CentOS 7,配置文件为/etc/lighttpd/lighttpd.conf 。

4安装PHP

我们可以通过PHP-FPM在Lighttpd中进行PHP工作,我们安装如下:

yum -y install php-fpm lighttpd-fastcgi

PHP-FPM是一个守护进程,在端口9000上运行FastCGI服务器。

打开/etc/php-fpm.d/www.conf ...

nano /etc/php-fpm.d/www.conf

...并将用户和组设置为lighttpd :[...]

; Unix user/group of processes

; Note: The user is mandatory. If the group is not set, the default user's group

; will be used.

; RPM: apache Choosed to be able to access some dir as httpd

user = lighttpd

; RPM: Keep a group allowed to write in log dir.

group = lighttpd

[...]

创建PHP-FPM的系统启动链接并启动它:

systemctl enable  php-fpm.service

systemctl start  php-fpm.service

lighttpd php7 源码安装,如何在CentOS 7上安装Lighttpd与PHP-FPM和MariaDB相关推荐

  1. linux centos7 r安装,如何在CentOS 7上安装R

    R是一种快速增长的开源编程语言和免费环境,专门从事统计计算和图形表示.它得到R统计计算基金会的支持,主要由统计学家和数据挖掘人员用于开发统计软件和执行数据分析. 本教程将教您如何在CentOS 7上安 ...

  2. opencv 安装_如何在 CentOS 8 上安装 OpenCV

    本文最先发表在: 如何在 CentOS 8 上安装 OpenCV​www.itcoder.tech OpenCV(Open Source Computer Vision Library) 是一个开源的 ...

  3. fortran安装_如何在 CentOS 8 上安装 GCC

    本文最先发布在: 如何在 CentOS 8 上安装 GCC​www.itcoder.tech GNU 编译器集合是一系列用于语言开发的编译器和库的集合,包括: C, C++, Objective-C, ...

  4. 如何在 CentOS 7 上安装 Nginx

    本文首发:开发指南:如何在 CentOS 7 上安装 Nginx Nginx 读作 engine x, 是一个免费的.开源的.高性能的 HTTP 和反向代理服务,主要负责负载一些访问量比较大的站点. ...

  5. 2019 年如何在 CentOS 7 上安装最新版 Nginx

    本文首发:开发指南:如何在 CentOS 7 上安装 Nginx Nginx 读作 engine x, 是一个免费的.开源的.高性能的 HTTP 和反向代理服务,主要负责负载一些访问量比较大的站点. ...

  6. centos 使用java_如何在CentOS 8上安装Java

    Java是用于构建不同类型的应用程序和系统的最流行的编程语言之一. Java有两种不同的实现,OpenJDK和Oracle Java,两者之间几乎没有区别,只是Oracle Java具有一些其他的商业 ...

  7. 如何在CentOS 7上安装Kubernetes Docker群集

    如何在CentOS 7上安装Kubernetes Docker群集 Kubernetes是一个开源平台,用于管理由Google开发的容器化应用程序.它允许您在集群环境中管理,扩展和自动部署容器化应用程 ...

  8. 如何在CentOS 7上安装和使用PostgreSQL

    原作者:米切尔·阿尼卡斯 转载来源:https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql ...

  9. 如何在CentOS 7上安装和配置MySQL Cluster

    翻译&转载:https://www.howtoforge.com/tutorial/how-to-install-and-configure-mysql-cluster-on-centos-7 ...

最新文章

  1. Load 方法 暨 程序的加载顺序
  2. 如何使用 Python 创建一名可操控的角色玩家
  3. winform 监听http_Winform HttpListener监听有关问题
  4. 总结H3CNE学习过程和其他
  5. C# JArray与JObject 的使用
  6. Ant 简单示例+环境变量配置说明
  7. nginx fastcgi python_webpy + nginx + fastcgi 构建python应用
  8. 2000元档855旗舰来了 网友:都过时了,哪有人买
  9. 问题-Delphi 中使用TStringList后,报out of memory 的解决方法
  10. qss 样式不生效--注释不能嵌套
  11. rman一致性备份oracle数据库可以在非归档模式下么,探索ORACLE之RMAN_03一致性备份...
  12. shareplex三点同步配置
  13. 2020-10-19
  14. 外设获取物理内存数据_Linux系统对IO端口和IO内存的管理
  15. VoIP技术应用中存在的问题的分析研究
  16. matlab篮球队需要五名队员,球队战绩影响因素分析.doc
  17. canvas教程7-炫彩小球
  18. 解决Tabby终端使用zsh主题字体无法识别问题
  19. MATLAB实现变限积分函数的积分/ 多重积分/ 如何解决求积分显示AB浮点标量报错
  20. 原装linux系统装win7系统,网购本自带Linux系统,要重装win7旗舰要到店里去吗?

热门文章

  1. CVCode简繁转换的扩展:GBK与Big5转换
  2. 告别繁琐提升效率,Docker 帮您降低从开发到部署的复杂性
  3. opengl加载多个3ds模型失败记
  4. js中函数传递参数,究竟是值传递还是引用传递?
  5. 面对 iPad,Surface 的键盘是必杀技
  6. 互联网或将进入泡沫2.0时代
  7. iframe高度动态自适应
  8. docker ps 只显示容器名称 显示列名
  9. mysql 排序 简介
  10. python3 处理 html转义字符