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

Building a LNMP server environment for Linux learning notes

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

Share

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

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!

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