Nginx source code (2) run

Source: Internet
Author: User
: This article describes how to run nginx source code (2). If you are interested in the PHP Tutorial, refer to it. Next Article
An error occurred while running. nginx cannot be found. conf file, which is in the conf Directory. to make it easier for us to change the default nginx PREFIX to the current directory, modify the PREFIX in the file auto/options to the current directory:

if [ ".$PREFIX" = "." ]; then    PREFIX=.fi

Create the logs and HTML folders in the source code directory, and create the file index.html in the HTML Directory. enter
success
Re-make clean and make to generate a new nginx binary file and run
sudo ./nginx
View processes
ps -ef|grep nginx
We can see that nginx has been successfully started. visit http: // localhost in the browser, and the page returns sucess!
View logs:
Access records in logs/access. log
If an error occurs, logs/error. log reports an error.
In logs/nginx. pid, it is the process number of the nginx process.

Note:
If root is not used for running, an error is returned:

13:44:13 [emerg] 19240 #0: bind () to 0.0.0.0: 80 failed (13: Permission denied)

If there is no HTML directory or index.html file, an error is returned:

13:47:55 [error] 19310 #0: * 1 "./html/" is not found (2: No such file or directory), client: 127.0.0.1, URL :/

Because I created a simple page without favicon. ico, the following error occurs:

13:47:55 [error] 19310 #0: * 1 open () ". /html/favicon. ico "failed (2: No such file or directory), client: 127.0.0.1, URL:/favicon. ico

A total of four processes are running:

Root 19715 1144 0? 00:00:00./nginx
Nobody 19716 19715 0? 00:00:00./nginx
Nobody 19717 19715 0? 00:00:00./nginx
Nobody 19718 19715 0? 00:00:00./nginx

The root permission runs the main process, and the other three are the work process.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.