Install the high performance Nginx web server on Ubuntu
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!
Install the high performance Nginx web server on Ubuntu的更多相关文章
- NGINX Web Server Nginx web server
原文地址:http://nginx.com/resources/admin-guide/web-server/ NGINX Web Server Nginx web server This secti ...
- 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 ...
- Enable directory listing on Nginx Web Server
1:Test environment [root@linux-node1 ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core ...
- CentOS 5.5 下安装Countly Web Server过程记录
CentOS 5.5 下安装Countly Web Server过程记录 1. 系统更新与中文语言包安装 2. 基本环境配置: 2.1. NodeJS安装 依赖项安装 yum -y install g ...
- 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 ...
- [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 ...
- add web server(nginx+apache)
#!/bin/bash # # Web Server Install Script # Last Updated 2012.09.24 # ##### modify by WanJie 2012.09 ...
- add web server(nginx)
#!/bin/bash # # Web Server Install Script # Last Updated 2012.09.24 # ##### modify by WanJie 2012.09 ...
- 在nginx中配置如何防止直接用ip访问服务器web server及server_name特性讲解
看了很多nginx的配置,好像都忽略了ip直接访问web的问题,不利于SEO优化,所以我们希望可以避免直接用IP访问网站,而是域名访问,具体怎么做呢,看下面. 官方文档中提供的方法: If you d ...
随机推荐
- 备份IIS
备份IIS,这里实质指的是备份IIS配置.如果要备份IIS部署的网站的话,直接Copy目录就行了. 备份IIS配置其实和备份系统含义差不多,为了方便系统或者IIS出现故障后能够及时恢复到某节点上,所以 ...
- P1726 上白泽慧音(0分)
题目描述 在幻想乡,上白泽慧音是以知识渊博闻名的老师.春雪异变导致人间之里的很多道路都被大雪堵塞,使有的学生不能顺利地到达慧音所在的村庄.因此慧音决定换一个能够聚集最多人数的村庄作为新的教学地点.人间 ...
- BZOJ2440: [中山市选2011]完全平方数 容斥原理_莫比乌斯函数
emmm....... 数学题都不友好QAQ...... Code: #include <cstdio> #include <algorithm> #include <c ...
- 使用highcharts动态绘制折线图——so easy
之前学习highcharts发现网上的教程大部分是对highcharts数据的注释,如何动态绘制数据大部分一笔带过,让那些初涉开发的小白云里雾里,所以我就写了一篇这样的博客. <html> ...
- debian 9 安装无线网卡
#添加源 echo "deb http://httpredir.debian.org/debian/ stretch main contrib non-free" >> ...
- linux rar 解压忽略带密码压缩包
#解压忽略密码 rar x -p- file.rar #解压忽略子目录 rar x -ep file.rar
- WampServer更改或重置数据库密码
WampServer安装后密码是空的, 修改一般有两种方式: 一是通过phpMyAdmin直接修改: 二是使用WAMP的MySql控制台修改. 第一种: ①在phpMyAdmin界面中点击[用户],将 ...
- java--web学习总结<转>
http://www.cnblogs.com/xdp-gacl/p/3729033.html
- NYIST 489 哭泣天使
哭泣天使时间限制:1000 ms | 内存限制:65535 KB难度:5 描述Doctor Who乘着Tardis带着Amy来到了一个星球,一开Tadis大门,发现这个星球上有个壮观的石像群,全是一些 ...
- ASP.NET-Active Direcotry编程示例
查找指定的AD帐号 using (DirectoryEntry de = new DirectoryEntry("LDAP://RootDSE")) { string DCName ...