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

How to build a LNMP environment for Ubuntu

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

Share

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

This article mainly introduces "how to build LNMP environment in Ubuntu". In daily operation, I believe many people have doubts about how to build LNMP environment in Ubuntu. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to build LNMP environment in Ubuntu". Next, please follow the editor to study!

Just like the MySQL installation, first enter "/ usr/local/src", type "cd / usr/local/src" enter, enter into the folder, and then type "sudo wget http://nginx.org/download/nginx-0.8.37.tar.gz" enter" and wait for the download to complete.

After the download is complete, execute "sudo tar zxvf nginx-0.8.37.tar.gz" to enter and extract the file.

Then go to the nginx source directory and configure the installation operation. Type "cd nginx-0.8.37" enter, and then execute "sudo. / configure-- prefix=/usr/local/server/nginx-- with-http_stub_status_module".

After the configuration is complete, start compiling the source code package. Type "sudo make & & make install" to enter and wait for the operation to finish.

Copy the nginx.sh in the attachment to / etc/init.d/nginx, type "sudo cp nginx.sh / etc/init.d/nginx" enter, and then execute "sudo chmod + x / etc/init.d/nginx".

Start nginx and execute "sudo / etc/init.d/nginx start" to start the server.

Enter "http://127.0.0.1" enter" in the browser, and the following page is displayed, indicating that the server started successfully.

Stop the server from entering the command "sudo / etc/init.d/nginx stop".

Attachment to the course nginx.sh

The code is as follows:

#! / bin/bash

#

# chkconfig:-85 15

# description: Nginx is a World Wide Web server.

# processname: nginx

Nginx=/usr/local/server/nginx/sbin/nginx

Conf=/usr/local/server/nginx/conf/nginx.conf

Case $1 in

Start)

Echo-n "Starting Nginx"

$nginx-c $conf

Echo "done"

Stop)

Echo-n "Stopping Nginx"

Killall-9 nginx

Echo "done"

Test)

$nginx-t-c $conf

Reload)

Echo-n "Reloading Nginx"

Ps auxww | grep nginx | grep master | awk'{print $2}'| xargs kill-HUP

Echo "done"

Restart)

$0 stop

$0 start

Show)

Ps-aux | grep nginx

*)

Echo-n "Usage: $0 {start | restart | reload | stop | test | show}"

Esac

At this point, the study on "how to build a LNMP environment for Ubuntu" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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: 244

*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