Get the App
SLTechnology News&Howtos  ›  Servers  › 

Building a LNMP server environment for Linux learning notes

Shulou Source: shulou.com Published: 2022-06-02 22:03:18 09月22日 Update

LNMP(linux+nginx+mysql+php) Server Environment Configuration

As a novice, I definitely need linux+nginx+mysql+php to experiment with some things, but the online tutorials are messy, today I will share a good quick integration environment installation package

System requirements: CentOS/RadHat/Fedora, Debian/Ubuntu/Raspbian/Deepin VPS

(1) cd /

(2)wget http://www.fuhuijinlai.com/lnmp.zip && unzip lnmp.zip (note: if zip is not installed, yum -y install zip)

(3)chmod -R 777 /usr/local/src/

(4)vi /etc/rc.d/rc.local

Add the following to the last line:

/usr/local/src/install.sh

(5)reboot

OK, wait for 30 minutes. Basically, the current Ali Cloud Block Storage and SSD hard disk can be installed very quickly. However, wait for 30 minutes to reconnect to the server and verify

Execute the following script

service mysqld restart

service nginx restart

/usr/local/php/sbin/php-fpm restart

If it's OK, congratulations, rookie.

(6)Clean up cancel autoinstall script

vi /etc/rc.d/rc.local Remove the following contents to avoid reinstalling next time you restart

/usr/local/src/install.sh

(7)The next step is to modify the database password.

vi /etc/my.cnf

Find thread_concurrency = 8,

Add content below him (password-free access)

skip-grant-tables

Exit Save (:wq)

Restart the database.

service mysqld restart

All right, access the database.

/usr/local/mysql/bin/mysql -u admin -p

No password needed at this time, enter to enter

To change the password for database admin, command

UPDATE user SET Password = password ('your password') WHERE User = 'admin';

exit, exit

re-edit

vi /etc/my.cnf

Delete skip-grant-tables and exit Save

Restart database service mysqld restart

and then access the database.

/usr/local/mysql/bin/mysql -u admin -p

At this point you need to enter your password

Normal entry, successful.

To create a new website,

Your domain name is xiaodi.com

mkdir -p /web/www/xiaodi.com (Create your website, upload your code here)

Create your domain name configuration file in/usr/local/nginx/conf/vhost/

vi /usr/local/nginx/conf/vhost/xiaodi.com.conf

add the following

server

{

listen 80;

server_name www.mglhc.com xiaodi.com;

index index.html;

root /web/www/xiaodi.com;

location ~ .*. php?$

{

fastcgi_pass 127.0.0.1:9000; #php forward parsing

fastcgi_index index.php;

include fcgi.conf;

}

access_log /web/log/xiaodi.com.log main;

}

Exit Save, Restart nginx

service nginx restart

Of course, your domain name needs to be resolved to the IP of the server

Now you can visit your website, at/web/www/xiaodi.com, add your content freely, php, html can be parsed normally

Isn't it very simple, much more reliable than other sharing, don't forget to like my younger brother!

Tags: Password data database content server environment service domain name website interpretation again file hard drive script configuration good successful messy next one line Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Apple macOS NVidia OPPO Reno