sudo apt-get update
sudo apt-get install nginx

sudo mkdir -p /var/www/example.com/html
sudo chown -R $USER:$USER /var/www/example.com/html
sudo chmod -R 755 /var/www
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/example.com
sudo nano /etc/nginx/sites-available/example.com
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html;
index index.html index.htm; server_name localhost; location / {
try_files $uri $uri/ =404;
}
}
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo service nginx restart
https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-14-04-lts
 

How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu的更多相关文章

  1. 用Keepalived搭建双Nginx server集群,防止单点故障

    综述: 浏览器访问虚拟IP: 192.168.1.57, 该虚拟IP被Keepalived接管,两个Keepalived进程分别运行在物理IP为192.168.1.56和192.168.1.59服务器 ...

  2. 配置 nginx server 出现nginx: [emerg] "root" directive is duplicate in /etc/nginx/server/blogs.conf:7

    在配置nginx 虚拟机时,执行 sudo /usr/sbin/nginx -t 报下面的错误: nginx: [emerg] nginx: configuration file /etc/nginx ...

  3. Setup VSFTPD Server with Virtual Users On CentOS, RHEL, Scientific Linux 6.5/6.4/6.3

    We have already shown you How to Setup VSFTPD Server on CentOS 6.5/6.4 in our previous article. In t ...

  4. TinyCore Nginx server with php-cgi and vsftpd

    http://blog.matchgenius.com/tinycore-nginx-server-with-php-cgi-and-vsftpd/ Create fast testing serve ...

  5. Configure Apache Virtual Hosts - CentOS 7

    Difficulty: 2Time: 15 minutes Want to host websites on your server? Using Apache? Great. This articl ...

  6. How To Set Up Apache Virtual Hosts on CentOS 6

    About Virtual Hosts 虚拟主机,用于在一个单一IP地址上,运行多个域.这对那些想在一个VPS上,运行多个网站的人,尤其有用.基于用户访问的不同网站,给访问者显示不同的信息.没有限制能 ...

  7. [译]rabbitmq 2.4 Multiple tenants: virtual hosts and separation

    我对rabbitmq学习还不深入,这些翻译仅仅做资料保存,希望不要误导大家. With exchanges, bindings, and queues under your belt, you mig ...

  8. #Virtual hosts #Include conf/extra/httpd-vhosts.conf 开启就不能启动apache

    #Virtual hosts#Include conf/extra/httpd-vhosts.conf我只要把其中任何一个开启就是吧#去掉就启动不了apache.怎么回事error.log是这样的ht ...

  9. Nginx模块之————RTMP模块在Ubuntu 14.04年的设置与搭建

    Nginx的设置,RTMP在Ubuntu 14.04 https://www.vultr.com/docs/setup-nginx-rtmp-on-ubuntu-14-04

随机推荐

  1. C#设计模式学习资料--观察者模式

    http://www.cnblogs.com/promise-7/archive/2012/05/14/2500759.html http://www.cnblogs.com/zhenyulu/art ...

  2. SAML - SSO(转)

    http://baike.baidu.com/view/758527.htm?fr=aladdin SAML即安全断言标记语言,英文全称是Security Assertion Markup Langu ...

  3. ./configure详解

    'configure'脚本有大量的命令行选项.对不同的软件包来说,这些选项可能会有变化,但是许多基本的选项是不会改变的.带上'--help'选项执行'configure'脚本可以看到可用的所有选项.尽 ...

  4. uva 10271

    DP  状态转移方程 dp[i][j] = min(dp[i-1][j], dp[i-2][j-1] + w)) dp[i][j] 指的是前i个筷子组成j组所花费的最小值 考虑第i个筷子是否参与第j组 ...

  5. HDU1465+递推

    经典的信封装信问题 f[ n ]  = ( n-1 ) * ( f[ n-1 ]+f[ n-2 ] ) #include<stdio.h> #include<string.h> ...

  6. 观察者模式实现INotifyPropertyChanged

    其实一直不知道INotifyPropertyChanged这个接口中PropertyChanged事件是什么时候有值的,因为在使用的时候,只要按步骤来就可以,因为我自己并没有对这个事件赋值,所以很好奇 ...

  7. python调试 设置断点

    1在所需要调试的地方加入如下代码: import pdb    pdb.set_trace() 2调试代码常用命令: 实例请见参考文献: 1http://www.cnblogs.com/qi09/ar ...

  8. FireBug 调试JS入门

    http://www.blogjava.net/vincent/archive/2009/04/14/265591.html   http://baike.baidu.com/link?url=0S2 ...

  9. 一步一步制作yaffs/yaffs2根文件系统(二)---安装BusyBox,构造/bin、/sbin、/usr、linuxr

    开发环境:Ubuntu 12.04 开发板:mini2440  256M NandFlash   64M SDRAM 交叉编译器:arm-linux-gcc 4.4.3点此可下载 BusyBox版本: ...

  10. Windows Embedded Compact 7新特性

    Windows® Embedded Compact 7是Windows Embedded CE的下一代产品,而Windows Embedded CE这款操作系统面向占用资源少的新颖设备.Windows ...