码迷,mamicode.com
首页 > 系统相关 > 详细

How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu

时间:2014-11-15 16:45:33      阅读:244      评论:0      收藏:0      [点我收藏+]

标签:style   http   io   ar   os   sp   on   art   bs   

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

标签:style   http   io   ar   os   sp   on   art   bs   

原文地址:http://www.cnblogs.com/yuliyang/p/4099344.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!