Get the App
SLTechnology News&Howtos  ›  Servers  › 

Cloud computing learning route course syllabus courseware: HTTP Server: Apache knowledge points

Shulou Source: shulou.com Published: 2022-06-03 07:51:36 09月14日 Update

Cloud Computing Learning Route course outline Courseware: HTTP Server: Apache knowledge points:

Version 2.4 or above is recommended

=

I. Foundation of Apache

Apache: www.apache.org

Software package: httpd

Service port: 80/tcp (http) 443/tcp (https,http+ssl)

Configuration file: / etc/httpd/conf/httpd.conf

/ etc/httpd/conf.d/*.conf

/ etc/httpd/conf.d/welcome.conf / / default test page

Second, install Apache

[root@apache ~] # yum-y install httpd

[root@apache ~] # systemctl start httpd

[root@apache ~] # systemctl enable httpd

Build a test page for the home directory of the website:

[root@apache ~] # vim / var/www/html/index.html

Tianyun

[root@apache ~] # vim / var/www/html/2.php

192.168.31.154/index.html

[root@apache ~] # sed-ri'/ ^ SELINUX=/cSELINUX=disabled' / etc/selinux/config

[root@apache ~] # setenforce 0

[root@apache] # firewall-cmd-- permanent-- add-service=http

[root@apache] # firewall-cmd-- permanent-- add-service=https

[root@apache] # firewall-cmd-- reload

Third, install PHP

[root@apache ~] # yum-y install php / / php as a module of Apache

[root@apache ~] # ll / etc/httpd/modules/libphp5.so

-rwxr-xr-x. 1 root root 4588368 Jun 24 2015 / etc/httpd/modules/libphp5.so

[root@apache ~] # ll / etc/httpd/conf.d/php.conf

-rw-r--r--. 1 root root 691 Jun 24 2015 / etc/httpd/conf.d/php.conf

[root@apache ~] # systemctl restart httpd

192.168.31.154/2.php

Fourth, install Mariadb

[root@apache ~] # yum-y install mariadb-server mariadb

[root@apache ~] # systemctl start mariadb.service

[root@apache ~] # systemctl enable mariadb.service

[root@apache ~] # mysql_secure_installation / / improve mariadb security [optional]

Set root password? [Y/n]

New password: 123

Re-enter new password: 123

[root@apache ~] # mysql-uroot-p123 / / login mariadb test

MariaDB [(none)] >\ Q

[root@apache ~] # rm-rf / var/www/html/*

[root@apache ~] # vim / var/www/html/index.php

Test result: php cannot connect to mysql

5. Configure php to connect to Mariadb

[root@apache ~] # yum-y install php-mysql

[root@apache ~] # php-m / / check what extensions are available in php

[PHP Modules]

Mysql

Mysqli

[root@apache ~] # systemctl restart httpd

VI. Basic configuration of Apache

[root@tianyun ~] # vim / etc/httpd/conf/httpd.conf

ServerRoot "/ etc/httpd" / / installation directory

Listen 80 / / listening port

IncludeOptional conf.d/.conf / / contains the .conf file under conf.d

User apache / / users running Apache

Group apache / / user groups running Apache

DirectoryIndex index.html index.php / / set the default home page

DocumentRoot / / site default home directory

/ / Apache access control

AllowOverride None

Allow open access:

Require all granted

=

Configure processes and threads for apache2.2 only for interviews

Prefork MPM / / process mode

StartServers 10 / / number of processes initially established

MinSpareServers 10 / / minimum number of idle processes

MaxSpareServers 15 / / maximum number of idle processes

ServerLimit 2000 / / the maximum number of processes started is 256by default

MaxClients 2000 / / the maximum number of concurrent connections is 256 by default

MaxRequestsPerChild 4000 / / the maximum number of requests per child process is allowed to respond during its life cycle, 0 does not limit

Worker MPM / / threading mode

StartServers 2 / / number of processes initially established

ThreadsPerChild 50 / / number of threads established by each process

MinSpareThreads 100 / / minimum number of idle threads

MaxSpareThreads 200 / / maximum number of threads in the space

MaxClients 2000 / / maximum concurrent visits (threads)

MaxRequestsPerChild 0 / / the maximum number of requests per child process is allowed to respond during its life cycle, 0 does not limit

=

Forget the MySQL password

MySQL 5.7.5 and earlier:

[root@mysql1 ~] # vim / etc/my.cnf

[mysqld]

Skip-grant-tables

[root@mysql1 ~] # service mysqld restart

[root@mysql1 ~] # mysql

Mysql > update mysql.user set password=password ("456") where user= "root" and host= "localhost"

Mysql > flush privileges

Mysql >\ Q

[root@mysql1 ~] # vim / etc/my.cnf

[mysqld]

# skip-grant-table

[root@mysql1 ~] # service mysqld restart

Tags: Process maximum thread test configuration directory idle minimum size cycle file mode life user port run limit outline tutorial knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology macOS Shulou Information Microsoft OPPO Reno