Look out Apache, there’s a web server – Nginx (pronounced Engine X) – that means to dismantle you as the defacto standard web server. The Nginx project started development in 2002, but it’s just now really showing its strength and starting to gain a serious following. Nginx is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server, and it’s known for high performance, stability, a vast feature set, easy configuration, and very low resource consumption.

Since Nginx is new to many users, I thought I should begin a series of articles to get everyone up to speed on using this fantastic web server. Throughout this series, I’ll be using the Ubuntu platform. You can use this series as the basis for other platforms – just pay close attention to the variances of installation technology and (in some cases) directory structure. With that said, let’s install Nginx on the Ubuntu platform.

Note: As this series won’t bother with basic platform setup and security, I’ll assume that you already have the server up and running and secure to your liking. I’ll also assume that you have MySQL up and running (along with PHP support).

Requirements

Nginx has few dependencies that Ubuntu doesn’t already take care of. Here’s what you’ll need:

  • The Gzip modules requires the zlib library
  • The rewrite module requires the pcre library
  • SSL support requires the openssl library

With the Ubuntu platform, the only library from the list above that you’ll need to install is the pcre library. To install this, follow these steps:

1.Open a terminal window

2.Issue the command:

sudo apt-get install libpcre3-dev

3.Type your sudo password and hit Enter

4.Accept the installation

5.Allow the installation to complete

Nginx can use PHP5 with the help of PHP-FPM (an alternative PHP FastCGI implementation with additional features, which is useful to busier sites). Here’s how to install PHP-FPM:

1.Open a terminal window

2.Issue the command:

sudo apt-get install php5-fpm

3.Type your sudo password (if prompted) and hit Enter

4.Accept the installation

5.Allow the installation to complete

Installing Nginx

As you might expect, the installation of Nginx is quite simple. Just follow these steps:

1.Open a terminal window

2.Issue the command:

sudo apt-get install nginx

3.Type your sudo password (if prompted) and hit Enter

4.Accept the installation

5.Allow the installation to complete

That’s it. The new web server is installed. Now, let’s peek around a bit.

Starting and stopping the server

To start the Nginx server, issue the following command:

sudo service nginx start

Top stop the Nginx server, issue the following command:

sudo service nginx stop

With the Nginx service started, fire up your browser and point it to the IP address (or domain) of the hosting server. If you see the “Welcome to Nginx” page, everything is good to go.

Before you close that terminal window, it’s necessary to set the Nginx service to start at boot. Just issue the following command:

update-rc.d nginx defaults

If you see:

System start/stop links for /etc/init.d/nginx already exist

That means Nginx is already set to start at boot time. You can now rest assured that you won’t have to manually start your web server upon reboot.

Configuration files/folders

  • The main configuration file for Nginx is /etc/nginx/nginx.conf
  • Virtual hosts are defined in /etc/nginx/sites-available/default
  • PHP will be configured in /etc/php5/fpm/php.ini

That should do it for Nginx installation on the Ubuntu platform. In upcoming posts, we’ll start working through various configurations and optimizations to round out the series. Enjoy your new web server!

reference:http://www.techrepublic.com/blog/linux-and-open-source/install-the-high-performance-nginx-web-server-on-ubuntu/

Install the high performance Nginx web server on Ubuntu的更多相关文章

  1. NGINX Web Server Nginx web server

    原文地址:http://nginx.com/resources/admin-guide/web-server/ NGINX Web Server Nginx web server This secti ...

  2. How to Install and Configure Bind 9 (DNS Server) on Ubuntu / Debian System

    by Pradeep Kumar · Published November 19, 2017 · Updated November 19, 2017 DNS or Domain Name System ...

  3. Enable directory listing on Nginx Web Server

    1:Test environment [root@linux-node1 ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core ...

  4. CentOS 5.5 下安装Countly Web Server过程记录

    CentOS 5.5 下安装Countly Web Server过程记录 1. 系统更新与中文语言包安装 2. 基本环境配置: 2.1. NodeJS安装 依赖项安装 yum -y install g ...

  5. Setting up Django and your web server with uWSGI and nginx

    https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html Setting up Django and your we ...

  6. [r]Setting up Django and your web server with uWSGI and nginx

    Setting up Django and your web server with uWSGI and nginx This tutorial is aimed at the Django user ...

  7. add web server(nginx+apache)

    #!/bin/bash # # Web Server Install Script # Last Updated 2012.09.24 # ##### modify by WanJie 2012.09 ...

  8. add web server(nginx)

    #!/bin/bash # # Web Server Install Script # Last Updated 2012.09.24 # ##### modify by WanJie 2012.09 ...

  9. 在nginx中配置如何防止直接用ip访问服务器web server及server_name特性讲解

    看了很多nginx的配置,好像都忽略了ip直接访问web的问题,不利于SEO优化,所以我们希望可以避免直接用IP访问网站,而是域名访问,具体怎么做呢,看下面. 官方文档中提供的方法: If you d ...

随机推荐

  1. SQLiteHelp

    using System; using System.Collections.Generic; using System.Text; using System.Data.SQLite; using S ...

  2. 利用bat批处理——实现数据库的自动备份和删除

    之前见别人一直在玩批处理,最近公司也在用,就顺便学习下: 首先创建一个 txt文件 命名BackupDataBase  并修改后缀为.bat 编写两条命令: sqlcmd -S . -E -Q &qu ...

  3. c# CacheHelper缓存帮助类

    一.开篇 主要功能:改善程序性能.服务器的响应速度,尤其是当数据的处理过程变得复杂以及访问量变大时,变得比较明显.有些数据并非时刻在发生变化,如果我们可以将一些变化不频繁的数据的最终计算结果(包括页面 ...

  4. 高并发之后端优化(PHP)

    页面静态化 使用模板引擎 可以使用Smarty的缓存机制生成静态HTML缓存文件 $smarty->cachedir=$ROOT·"/cache"://缓存目录 $smart ...

  5. Python 递归和二分查找

    # 二分查找l1 = [2,3,5,10,15,16,18,22,26,30,32,35,41,42,43,55,56,66,67,69,72,76,82,83,88] def two_search( ...

  6. ajax的post提交方式和传统的post提交方式哪个更快?

    如果同时用ajax和post提交先执行哪个呢?是ajax返回后再执行post呢还是同时执行? ajax的post提交方式和传统的post提交方式哪个更快? >> php这个答案描述的挺清楚 ...

  7. 页面定制CSS代码初探(一):页面变宽 文本自动换行 图片按比缩放

    初识博客 初写博客,先在设置里选了个喜欢的模板 第一眼就爱上了呢!那极简的风格,我喜欢!!但是,应用后,却发现... 纳尼!模板上右侧那张漂亮的图片呢?!我的怎么什么都没有.没有图片好难看啊,瞬间无爱 ...

  8. ZBrush中平滑笔刷介绍

    平滑笔刷在ZBrush®中的使用颇多,它可以在ZBrush®模型的多层细分下工作,并且能够控制对模型的平滑效果,而且还能将模型的细节完整保留.默认情况下,按住Shift键就会切换到平滑笔刷,根据调整不 ...

  9. 路飞学城Python-Day29(第四模块-并发编程)

    01-进程与程序的概念 并发:多进程和多线程 进程的概念:进程就是正在执行的过程,一个应用程序不是进程,只有应用程序启动以后才能说是进程,进程是一个抽象的概念,起源于操作系统 02-操作系统介绍 应用 ...

  10. swoole 清除定时器提示no timer

    首页确定一个核心概念 clearTimer仅可清除当前进程的定时器 server代码如下: <?php class Server { private $serv; private $timer; ...