Nginx Source (2) Run

Source: Internet
Author: User
Pick up a previous article
Run times wrong, can't find the nginx.conf file, this file in the Conf directory, in order to facilitate our default Nginx prefix to the current directory, modify the file auto/options prefix defined as the current directory:

if".$PREFIX""."then    PREFIX=.fi

Create a new folder in the current source directory logs and HTML, in the HTML directory to create a new file index.html, enter
success
Re-make Clean,make, generate a new nginx binary file, run
sudo ./nginx
View process
ps -ef|grep nginx
Can see Nginx has successfully started, access http://localhost in the browser, the page returned sucess!
To view logs:
Access record in Logs/access.log
If there is an error, there is an error message in Logs/error.log.
Logs/nginx.pid is the process number of the nginx process.

Attention:
If you do not run with root, you will get an error:

2015/03/15 13:44:13 [Emerg] 19240#0:bind () to 0.0.0.0:80 failed (13:permission denied)

If you do not have an HTML directory and the following index.html file, you will get an error:

2015/03/15 13:47:55 [ERROR] 19310#0: * "./html/" is not found (2:no such file or directory), client:127.0.0.1, URL:/

Because I built a simple page, no favicon.ico, so here will be an error:

2015/03/15 13:47:55 [ERROR] 19310#0: * Open () "./html/favicon.ico" failed (2:no such file or directory), client:127.0.0 .1, URL:/favicon.ico

At run time, a total of 4 processes:

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

Root privilege is the main process, and the other 3 are the work processes.

The above describes the Nginx source code (2) run, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.