当前位置:网站首页>Lamp architecture that your girlfriend can read

Lamp architecture that your girlfriend can read

2022-06-23 16:39:00 User 7353950

1、LAMP What do they stand for

•L Use... On behalf of the server operating system Linux

•A On behalf of the website service, we use Apache In the software foundation httpd Software for

•M When representing the database used in the background of the website MySQL database

•P The representative website is using PHP/Perl/Python Wait for language development

2、Apache/MySQL/PHP What is the function of each

Said in the previous :

 We can LAMP Architecture is understood as a hotel ! The hotel ! The hotel !

 Our restaurant is very special , Our little sister at the front desk is very beautiful , Our waiter and chef are ugly

 Waiters and chefs are so ugly that they can't be seen ( Self brain tonic ), So when you go to the hotel, you can only see the little sister at the front desk

㈠ Chat Apache(httpd)

• It looks like the front desk

• effect : Provide web service , Accept the user's connection request !

Be careful :Apache or Nginx Only static page parsing is supported

When the client requests static resources ,web service (httpd Program ) It will directly return static resources to the client

① Static web page

• Static web pages refer to the use of HTML( Hypertext markup language ) To write , The general suffix is .htm、.html etc. ; There is no program code in the web page file

• Static web page , The user double clicks to open , See the effect and web The server is the same , Because the content of the web page is before the user visits , That's for sure

② Dynamic web pages

• Dynamic web pages refer to websites written in a specific programming language , In the web file except HTML Beyond the mark , It also includes some program code to realize specific functions

• The server can dynamically generate web page content according to different requests of the client

• Dynamic web page suffix is generally .php、.asp、.aspx、cgi、.perl、.jsp etc.

• Common message boards 、 Forum 、 register 、 Posting is realized by dynamic web pages

③ Summary

1) What is? web service ?

answer : A web service that provides Web browsing .

Installed web Service software such as ,httpd/nginx Such as software , And start the . Customers can access the website through the browser .

2) What is? Web The server ?

answer : To understand it simply is to install web Service Software , And can provide Web Machines served .

3)Web It is generally divided into client and server , How do the two interact ?

answer : adopt HTTP agreement http://www.itcast.cn

4)Apache(httpd) Function and characteristics of ?

answer :Apache Used to accept user connection requests ; Only responsible for static page parsing .

㈡ Chat PHP

• Like a waiter

• effect :PHP Mainly responsible for PHP The analysis and implementation of script program MySQL Database interaction , Registration in our project / Sign in / Place an order / Most functions such as payment are based on PHP+MySQL To implement .PHP Is a general open source scripting language .

1. When the client requests a dynamic resource ,Apache(httpd Program ) Would call libphpX.so Module for corresponding analysis

2. If the parsing process needs to use the relevant data of the background database , here php The program will also connect to the background database

3. Final php The program returns the parsed results to Apache(httpd Program ), Give Way Apache Return to the client

㈢ Chat MySQL

• Like a chef

• effect :MySQL Is a relational database management system , The Swedish MySQL AB Companies to develop , At present belongs to the Oracle Its products . Its main function is to store data permanently .

3、LAMP What is architecture

• It's like a hotel

( One )Apache It's like a hotel front desk , Specifically used to accept customer requests , And do some static page processing ( Buy only drinks )

( Two )PHP It's like a server , It is specially used to parse and handle what cannot be handled by the front desk ” Order ”, If the user wants to eat a bowl of spaghetti , The waiter needs to communicate with the kitchen , And make corresponding arrangements . Then return the processed result to the foreground , The front desk will give it to the user , Because the waiter is so ugly , No one can see .

( 3、 ... and )MySQL It looks like a kitchen , It is specially used for storing food materials , And only the middle waiter can communicate with the kitchen , To get what ingredients

• The professional explanation is as follows

( One ) Client sends request connection web Server's 80 port , from Apache Respond to and process the user's static requests

( Two ) If the client requests dynamic resources , from Apache Load calls libphpX.so modular ( install php Program bring ) Do parsing

( 3、 ... and ) If the processing needs to communicate with the background database , So by the php Program to complete

( Four )Php The program returns the processed results to Apache, from Apache Return to the client

Two 、 One key deployment LAMP Environmental Science

Environmental statement : The current system version is RedHat8.0 System

1、 Basic environment configuration

㈠ Close the firewall and selinux

Turn off firewall temporarily

[[email protected] ~]# systemctl stop firewalld.service

The next boot will not start automatically

[[email protected] ~]# systemctl disable firewalld.service

[[email protected] ~]# systemctl list-unit-files |grep firewalld

firewalld.service disabled

close selinux

[[email protected] ~]# setenforce 0

[[email protected] ~]# getenforce

Permissive

[[email protected] ~]# vim /etc/selinux/config

...

SELINUX=disabled

....

㈡ Configure the local software warehouse

Manually mount the disc locally /mnt Next

[[email protected] ~]# mount -o ro /dev/sr0 /mnt

Boot up automatically

[[email protected] ~]# echo "mount -o ro /dev/sr0 /mnt" >> /etc/rc.local

[[email protected] ~]# chmod +x /etc/rc.d/rc.local

Modify the configuration file to specify the software warehouse

[[email protected] ~]# cd /etc/yum.repos.d/

[[email protected] yum.repos.d]# cat local.repo

[BaseOS]

name=BaseOS yum

baseurl=file:///mnt/BaseOS/

enabled=1

gpgcheck=0

[App]

name=Appstream yum

baseurl=file:///mnt/AppStream/

enabled=1

gpgcheck=0

2、 One click build LAMP Environmental Science

㈠ install Apache(httpd) Software

explain :RedHat8 Default by oneself httpd-2.4.37 edition

[[email protected] ~]# yum install httpd -y

㈡ install PHP Related software

explain :RedHat8 Default php-7.2 edition

yum -y install php-xml-7.2.11-1.module+el8+2561+1aca3413.x86_64

php-json-7.2.11-1.module+el8+2561+1aca3413.x86_64

php-mysqlnd-7.2.11-1.module+el8+2561+1aca3413.x86_64

php-common-7.2.11-1.module+el8+2561+1aca3413.x86_64

php-fpm-7.2.11-1.module+el8+2561+1aca3413.x86_64

php-bcmath-7.2.11-1.module+el8+2561+1aca3413.x86_64

php-cli-7.2.11-1.module+el8+2561+1aca3413.x86_64

php-7.2.11-1.module+el8+2561+1aca3413.x86_64

php-gd-7.2.11-1.module+el8+2561+1aca3413.x86_64

php-pdo-7.2.11-1.module+el8+2561+1aca3413.x86_64

php-devel-7.2.11-1.module+el8+2561+1aca3413.x86_64

㈢ install Mariadb Database software

explain : from RedHat7 in the future , System default Mariadb database

[[email protected] ~]# yum install mariadb-server mariadb

3、 Start the corresponding service

㈠ Start the background database

[[email protected] ~]# systemctl start mariadb.service

[[email protected] ~]# systemctl enable mariadb.service

[[email protected] ~]# netstat -nltp|grep 3306

tcp6 0 0 :::3306 :::* LISTEN 45368/mysqld

[[email protected] ~]# mysqladmin -u root password '123'

㈡ Start the front end web service

[[email protected] ~]# systemctl start httpd.service

[[email protected] ~]# systemctl enable httpd.service

[[email protected] conf]# netstat -nltp|grep :80

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 45593/httpd

4、 Test whether it can be parsed php page

[[email protected] ~]# vim /var/www/html/index.php

[[email protected] ~]# cat /var/www/html/index.php

<?php

phpinfo();

?>

3、 ... and 、 Online shopping mall project

1、 Upload the website source code to web The server

[[email protected] ~]# mkdir /lamp

[[email protected] ~]# ls /lamp/

phpshe1.7.zip

2、 Unzip and copy it to the specified location

• Unzip and copy the source file of the website to the specified location

[[email protected] ~]# cd /lamp/

[[email protected] lamp]# unzip phpshe1.7.zip

[[email protected] lamp]# mv phpshe1.7/* /var/www/html/

• Change the permission of the source file of the website

[[email protected] lamp]# chown -R apache.apache /var/www/html/

3、 Install mall system

http://192.168.159.100/install

4、 restart web service ( Optional )

Four 、 Test verification

1、 Front desk visit

http://192.168.159.100

2、 Backstage access

http://192.168.159.100/admin.php

原网站

版权声明
本文为[User 7353950]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206231553182761.html

随机推荐