CentOS7 manual installation and configuration Lighttpd+PHP+MYSQL website environment record

888u

Last update at :2024-06-16,Edit by888u

We use more Nginx and Apache in the general VPS server website environment. In fact, there are also many WEB server architecture software including Lighttpd that are commonly used or liked by some users. As an open source WEB server software, Lighttpd is used by many users due to its low resource usage, high flexibility and compatibility, and rich module functions.

Today Snail helped a netizen who needed a VPS environment with simple PHP functions. He didn’t even need to use a database. He also mentioned whether it was possible to install the Lighttpd WEB environment, because there were previous articles that used the Lighttpd environment and it was based on Debian distribution. Version, this time I plan to use the CentOS7 release version and install the latest 1.4 stable version of Lighttpd to make a record.

Snail has previously covered Lighttpd website environment articles:

1. Use Lighttpd/SQLite/PHP environment to build Typecho/ZBLOG PHP site

2. Install Lighttpd/SQLite/PHP website building environment on Debian system

First, install the necessary software packages

1. Install EPEL

yum install epel-release

2. Upgrade the system environment package

yum update -y

Second, install Lighttpd

1. Automatic installation

yum install lighttpd -y

2. Manual installation

Here we can go to the official lighttpd website to manually install the latest lighttpd version.

wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.39.tar.gztar -zxvf lighttpd-1.4.39.tar.gzcd lighttpd-1.4.39./configuremake && make install

At present, the latest stable version of lighttpd is 1.4, but manual installation is a little more troublesome. If we only need a simple environment, just yum will do.

Third, configure lighttpd

If we need to further configure the lighttpd web server, we can change the default configuration file, which is located in /etc/lighttpd/lighttpd.conf. Because the default configuration is used here without modification, and we want to check for errors in the configuration file, we need to run the following command.

lighttpd -t -f /etc/lighttpd/lighttpd.conf

1. Create a directory

mkdir -p /srv/www/htdocs/cp -r /var/www/lighttpd/* /srv/www/htdocs/

According to our own habits, we can put the website directory in /srv/www/htdocs/, we will create one, and then copy the default /var/www/lighttpd/ file.

2. Start lighttpd

systemctl start lighttpdsystemctl enable lighttpd

3. Turn on the firewall

firewall-cmd –permanent –add-service=httpfirewall-cmd –reload

At this time, we can directly enter the IP address in the browser and see the success interface.

Seeing this interface is basically a success.

Third, install PHP

1. Install PHP5 module

yum install php php-cgi php-fpm php-mysql php-curl php-gd php-intl php-pecl-imagick php-mcrypt php-memcache php-pear lighttpd-fastcgi

2. Configure Lighttpd

/etc/php.ini

Modify the above file to make the cgi.fix_pathinfo=1 line available and remove the preceding comment symbol.

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

Edit this file and add two lines.

user = lighttpdgroup = lighttpd

Just add it to the end.

/etc/lighttpd/modules.conf

Edit this file, remove the # in front of include \\”conf.d/fastcgi.conf\\” and save it.

/etc/lighttpd/conf.d/fastcgi.conf

Set up this file.

/etc/lighttpd/conf.d/fastcgi.conf

Add last

fastcgi.server += ( \\”.php\\” =>((\\”host\\” => \\”127.0.0.1\\”,\\”port\\” => \ \"9000\\",\\"broken-scriptfilename\\" => \\"enable\\")))

Finally execute systemctl force-reload lighttpd to restart to take effect.

Fourth, detect PHP

We add a php.info file in the root directory and throw in the probe to check whether it takes effect.

Fifth, install MYSQL

Because Snail does not need to install MYSQL here, if we need to install MYSQL, it is easy, just run the command directly.

yum install mysql mysql-server

Just follow the prompts to set it up.

mysql_secure_installation

After the installation is complete, you need to execute the command to process the security settings of MYSQL.

To summarize, we can install Lighttpd and PHP environments in the VPS server in just a few simple steps. However, this type of environment is not suitable for our regular website building because the supported components and some convenient settings are not enough to meet the needs of some websites, such as some There aren’t many components yet. This article can only be regarded as a simple record of the process of Lighttpd. There are many individuals on the Internet who have shared one-click packages to install the Lighttpd website environment. Later, when Snail had time, he also installed it and shared it with everyone. It is suitable for us website users.

Recommended site searches: php website space, foreign vps, Guangdong website registration, Japanese server free, how to rent a foreign server, rent a server, Guangdong server rental, free personal cloud server outside mainland China, me domain name, Hong Kong server hosting,

CentOS7 manual installation and configuration Lighttpd+PHP+MYSQL website environment record

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码