Installation and configuration process of nginx in Ubuntu

Source: Internet
Author: User

1. Run command at Terminal:$sudo apt-get Install Nginx

Ubuntu after installing Nginx file structure is roughly:

All configuration files are under/etc/nginx, and each virtual host is already under/etc/nginx/sites-available

Startup program Files in/usr/sbin/nginx

The logs were placed in the/var/log/nginx, Access.log and Error.log, respectively.

and has created a startup script Nginx under/etc/init.d/

The default virtual host directory is set to/usr/share/nginx/html


After installation, enter http://localhost/in the browser and a welcome word will appear. This page is/usr/share/nginx/html under the index.html.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/58/9A/wKiom1S05xqz2ie6AAFBG5dM5w0827.jpg "title=" 1.png " alt= "Wkiom1s05xqz2ie6aafbg5dm5w0827.jpg"/>,

Run command nginx-v to know the current version


2. Create your own virtual directories and virtual host names

Creating Catalogs/var/www/ecc and/var/www/vhosts

Create the file/var/www/ecc/index.html, and write the word "a" in index.html on the "a" test page.

Create File/VAR/WWW/VHOSTS/ECC (this is a configure file)

server{Listen 80;        server_name ecc.com location/{index.index.html;    ROOT/VAR/WWW/ECC; }}

Edit the file/etc/nginx/nginx.conf, near the end line, row include/etc/nginx/sites-enabled/*, followed by a row

include/var/www/vhosts/*;


3. Run the command sudo nginx-t to test the syntax and configuration of the Configure file correctly.

If correct, there will be results:

Nginx:the configuration file/etc/nginx/nginx.conf syntax is oknginx:configuration file/etc/nginx/nginx.conf test is su Ccessful


4. Add the newly created domain name in the/etc/hosts file (if it is running natively)

Ecc.com


5. Restart the nginx.

Run command: Sudo/etc/init.d/nginx restart


6. Enter ecc.com in the browser to browse your test page index.html

This article is from the "Epicor, Magento" blog, so be sure to keep this source http://3154408.blog.51cto.com/3144408/1603643

Installation and configuration process of nginx in Ubuntu

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.