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

Summary of basic configuration based on LNMP and LNAMP Architecture

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Basic configuration of web site based on LNMP (Linux+Nginx+Mariadb+php-fpm) architecture.

The combination of nginx and php:

Run in fastcgi mode

1. The backend server installs the php-fpm module: (do not install the php module, both cannot be installed at the same time)

Yum install php-fpm php-common

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

Listem 0.0.0.0 listem 9000 (be sure not to use *: 9000 format); listen.allowed_clients = 127.0.0.1 allows linked clients to default to anyuser=nginxgroup=nginxpm.status_path = / status open pm status display ping.path = / pingping.response = pongphp_ [session.save _ handler] = files php_ value [Sessi on.save_path] = / var/lib/php/session

Start the php-fpm service

3. Create a directory to store page resources

Mkdir-pv / data/shopvim / data/shop/index.php # Edit a test page

4. Configure the front-end nginx server

Vim / etc/nginx/conf.d/server.conf location ~\ .php$ {root html; fastcgi_pass 172.16.254.226 root html; fastcgi_pass 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / data/shop$fastcgi_script_name; # indicates the resource path mapping include fastcgi_params;} under the request fpm server

5. Configure the mariadb data host

Yum install mariadb-server php-mysql systemctl restart mariadb mysql-uroot-p GRANT ALL ON mydb.* TO 'myuser'@'127.0.0.1' IDENTIFIED BY' mypass'; GRANT ALL ON mydb.* TO 'myuser'@'localhost' IDENTIFIED BY' mypass'; FLUSH PRIVILEGES

6. You can write a test page that links to the database to test.

Web site basic configuration based on LNAMP (Linux+Nginx+Mariadb+ [Apache + Php]) architecture.

Implemented with three hosts:

Node1 acts as a reverse proxy for nginx:

Node2, as the web server of nginx, is mainly responsible for responding to static content and configuring nfs to realize shared files.

Node3 as the back-end server of apm

Install and configure wordpress

Configuration of node1:

Ntpdate 172.16.0.1yum install nginx

Configuration / etc/nginx/conf.d/proxy.conf

Server {listen 80; server_name www.abc.com; access_log / var/log/wordpress/access.log main; localtion / {index index.html index.php; proxy_pass http://172.16.251.76:80;} location ~\ .php$ {proxy_pass http://172.16.251.65;}}

Configuration of node2:

Ntpdate 172.16.0.1 yum install nginx

Configuration / etc/nginx/conf.d/wordpress.conf

Server {listen 80; server_name www.abc.com; access_log / var/log/wordpress/access.log main; location / {root / apps/web/wordpress; index index.html;}}

Configuration of node3:

Ntpdate 172.16.0.1yum install httpd php php-mysql mariadb-server

Configuration / etc/httpd/conf.d/wordpress.conf

DirectoryIndex index.php DocumentRoot "/ apps/web/wordpress" ServerName www.abc.com Options FollowSymLinks AllowOverride None Require all granted systemctl restart httpd

You can enter the test domain name in the browser and access it.

The above is the configuration implementation of the basic content part of lnmp and lnamp.

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

Servers

Wechat

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

12
Report