Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

LAMP building

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

LAMP building

Description: simulate and build LAMP on a linux host

Brief introduction:

LAMP consists of four parts: Linux,Apache,MySQL,PHP. This set of architecture is built to realize the deployment of dynamic web page environment. This article will simulate the deployment of a LAMP environment on a linux host of centos7.3. Apche environment uses httpd application deployment, MySQL uses Mariadb application deployment, php mainly uses php-fpm application deployment, and the auxiliary application is php-mbstring php-mcrypt php-xcache. The interface between PHP and MySQL is connected by php-mysql application. The back-end php server simulated in this paper is realized by php-fpm application. It is a FASTCGI process management tool, especially suitable for websites with high concurrency.

Composition:

A:apache (Httpd)

M:MySQL (Mariadb)

P:PHP (php-fpm)

Topological graph

1. Environmental preparation:

Operating system: window10

Browser: chrome

Virtual machine: VMware workstation11

MySQL graphical interface management tool: phpMyAdmin

Experimental operating system: centos7.3

Package preparation: mariadb-server php-fpm php-mysql httpd

two。 System initialization:

Turn off the firewall iptables-F turn off the firewall start systemctl disable firewalld.service turn off SElinux setenforce 0

3.mariadb-server installation and environment configuration

Install mariadb-server yun install mariadb-server to modify mariadb server configuration vi / etc/my.cnf.d/server.cnf modify configuration # this is only for the mysqld standalone daemon [mysqld] skip_name_resolve=on # skip domain name resolution innodb_file_per_table=ON check whether port 3306 of mariadb enables ss-tln

Restart the database systemctl start mariadb.service mysql test mysql

Note: I have set the password for mysql. If I do not have a password, I can use the above command to secure mysql_secure_installation mysql # and make corresponding changes according to my own needs to establish a test user grant all on testdb.* to 'hu'@'192.168.%.%' identified by' 123456' The other terminal logs in to mysql ssh 192.168.0.3 mysql-uhu-h292.168.0.3-p123456

4.php installation and environment configuration

Install php-related applications yum install php-fpm php-mysql php-mbstring php-mcrypt php-xcache-y enter the php-fpm environment configuration directory cd / etc/php-fpm.d/ to back up the original files cp www.conf {, .bak} modify the configuration file vi / etc/php-fpm.d/www.conf description: the comments in this configuration file are used (semicolon) marking, if you want to turn on some functions, cancel; you can. The following is a list of some options, which you can modify according to your needs [if you want to communicate across hosts Modify listening address] listen = 127.0.0.1 listen.allowed_clients 9000 [fastcgi client address] listen.allowed_clients = 127.0.0.1 [fpm built-in status page path] pm.status_path = / status [test server ping] ping.path = / ping [ping response] ping.response = pong [path to save session] Php_ value [session. Save _ path] = / var/lib/php/session is here In order to test, I need to turn on the following function pm.status_path = / pmstatus php_ value [session.save _ path] = / var/lib/php/session to create a directory to save the session mkdir / var/lib/php/session-pv modify the directory owner chown apache:apache / var/lib/php/session restart php-fpm Configure effective systemctl start php-fpm.service to view php port and process ss-tln ps aux | grep pool

5.httpd installation and environment configuration

Install httpd yum install httpd to check if proxy_fcgi_module exists httpd-M enters the httpd configuration directory cd / etc/httpd/conf.d/ virtual host configuration vi huwho.conf DirectoryIndex index.php DocumentRoot "/ web/www/html" ServerName "www.huwho.cn" ProxyRequests Off ProxyPassMatch ^ / (.*\ .php) $fcgi://127.0.0.1:9000/web/www/html/$1 ProxyPassMatch ^ / (pmstatus.*) $fcgi://127.0.0.1:9000/$1 Options FollowSymLinks AllowOverride None Require all granted # configuration instruction reference Official document: http://httpd.apache.org/docs/2.4/ create web page path mkdir / web/www/html-pv check syntax httpd-t enter web path directory cd / web/www/html/ edit php test page vi phpinfo.php modify windows10 domain name resolution file (hosts) path: C :\ Windows\ System32\ drivers\ etc purpose: to enable windows to resolve the set domain name natively

Restart the httpd service systemctl restart httpd.service access page

View page status information

Installation of 6.MySQL graphical interface management tools

Download phpMyAdmin-4.0.10.20-all-languages.tar.gz download address https://www.phpmyadmin.net/ extract (recommended directory / web/www/html) tar-xf phpMyAdmin-4.0.10.20-all-languages.tar.gz create a soft connection (because the name is too long) ln-sv phpMyAdmin-4.0.10.20-all-languages.tar.gz pma enter Enter the directory cd pma to change the name cp config.sample.inc.php config.inc.php edit configuration file vi config.inc.php modify the encrypted field $cfg ['blowfish_secret'] =' fsff34242regtegdsf3a8b7c6d' access page in the following sentence

7 pressure test

Vi / etc/hosts # add domain name resolution information 10.0.0.110 www.huwho.cn stress test ab-n 1000-c 20 http://www.huwho.cn/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report