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. 商品库存SKU

    一种解决方案(性能垃圾,基本实现功能)商品表  属性集表 属性表 属性值表 SKU表 SKU选项表  属性集和属性之间的中间表表关系商品表  *--------------1  属性集表属性集表 *- ...

  2. (转)关于Struts 2 拦截器参数丢失问题

    from:http://www.cnblogs.com/huzx/archive/2011/06/09/2076328.html 今天在做用户的登陆认证的时候出现的问题. 在传参数的时候,发现参数丢失 ...

  3. 浏览器对象模型(BOM)

    BOM结构 用户浏览网页的时候,浏览器会自动创建一些对象,这些对象存放着浏览器窗口的属性和相关信息,也就是大家熟称的BOM.浏览器对象模型是一个层次化的对象集,我们可以通过window对象访问所有对象 ...

  4. python:Attempted relative import in non-package

    problem:Attempted relative import in non-package 所谓相对路径其实就是相对于当前module的路径,但如果直接执行脚本,这个module的name就是“ ...

  5. Connect to the mysql dataase from remote server

    Make sure that the firewall is closed!!!!!!!!! shell command should be like is: mysql -u username -p ...

  6. C/C++ 框架,类库,资源集合

    很棒的 C/C++ 框架,类库,资源集合. Awesome C/C++ Standard Libraries Frameworks Artificial Intelligence Asynchrono ...

  7. 查看使用的Eclipse版本

    第一种方法 1. 找到Eclipse的解压目录就是你的Eclipse.exe 所在的目录 2. 找到 .eclipseproduct 文件双击打开

  8. Java Socket实战之一 单线程通信

    本文地址:http://blog.csdn.net/kongxx/article/details/7259436 现在做Java直接使用Socket的情况是越来越少,因为有很多的选择可选,比如说可以用 ...

  9. iOS如何把导航默认的返回按钮设置成“返回”

    版权声明:本CSDN博客所有文章不更新,请关注标哥博客:http://www.henishuo.com/ - (void)addBackItemWithAction:(SEL)action { if  ...

  10. ENVI5.1安装破解教程

    原文地址:  ENVI5.1安装破解_百度经验 http://jingyan.baidu.com/article/020278118b5ded1bcd9ce57a.html   ENVI5.1_x86 ...