Previous= $store.search.results.main.result.stats.totalNbPages” type=button

Traducciones al Español

A LAMP stack is a particular bundle of software packages commonly used for hosting web content. The bundle consists of Linux, Apache, MariaDB, and PHP (LAMP). This guide shows you how to install a LAMP stack on a CentOS 7 darkedeneurope.com.

Đang xem: How to install linux, apache, mysql, php (lamp) stack on centos 7

Before You Begin

Apache

Install and Configure

Install Apache using CentOS’s package manager.

Install Apache 2.4:

sudo yum install httpdEnable Apache to start at boot and start the Apache service:

sudo systemctl enable httpd.servicesudo systemctl start httpd.serviceCreate a httpd-mpm.conf file and add the code in the example to turn off KeepAlive and adjust the resource use settings. The settings shown below are a good starting point for a darkedeneurope.com 2GB:

Note

Create a symbolic link from your virtual hosts file in the sites-available directory to the sites-enabled directory. Replace example.com.conf with the name of your own virtual hosts file.

sudo ln -s /etc/httpd/sites-available/example.com.conf /etc/httpd/sites-enabled/example.com.conf

Configure SELinux to Allow HTTP

SELinux is enabled by default on CentOS 7 darkedeneurope.coms. Its default setting is to restrict Apache’s access to directories until explicit permissions are granted.

Without these steps, Apache does not start and may give the following error:

Jun 21 17:58:09 example.com systemd<1>: Failed to start The Apache HTTP Server.Jun 21 17:58:09 example.com systemd<1>: Unit httpd.service entered failed state.Jun 21 17:58:09 example.com systemd<1>: httpd.service failed.Use chown to make apache the owner of the web directory:

sudo chown apache:apache -R /var/www/html/example.com/Modify the permissions for files and directories:

cd /var/www/html/example.com/find . -type f -exec sudo chmod 0644 {} ;find . -type d -exec sudo chmod 0755 {} ;Use SELinux’s chcon to change the file security context for web content:

sudo chcon -t httpd_sys_content_t /var/www/html/example.com -Rsudo chcon -t httpd_sys_rw_content_t /var/www/html/example.com -REnable Apache to start at boot and restart the service for the above changes to take place:

sudo systemctl enable httpd.servicesudo systemctl restart httpd.serviceNote
In addition, if you plan to use any HTTPD scripts on the server, update the corresponding SELinux Boolean variable. To allow HTTPD scripts and modules to connect to the network, use the sudo setsebool -P httpd_can_network_connect on command.

Xem thêm:

Configure FirewallD to Allow HTTP Connections

FirewallD is enabled for CentOS 7 darkedeneurope.coms, but HTTP is not included in the default set of services.

View the default set of services:

sudo firewall-cmd –zone=public –list-servicesssh dhcpv6-clientTo allow connections to Apache, add HTTP as a service:

sudo firewall-cmd –zone=public –add-service=http –permanentsudo firewall-cmd –zone=public –add-service=httpVisit your domain or public IP to test the Apache server and view the default Apache page.

Note

Rename Apache’s default welcome page. When this file is present it takes precedence over other configurations via the LocationMatch directive.

Xem thêm: Top 5 Phần Mềm Quản Lý Khách Sạn Tốt Nhất Hiện Nay, Phần Mềm Quản Lý Khách Sạn

sudo mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.bk

Ensure that all lines noted above are uncommented. A commented line begins with a semicolon (;).

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *