Skip to content

Instantly share code, notes, and snippets.

@Baozi2
Created April 19, 2018 10:05
Show Gist options
  • Save Baozi2/ba0d30e1eef5242664e709fbfe85762d to your computer and use it in GitHub Desktop.
Save Baozi2/ba0d30e1eef5242664e709fbfe85762d to your computer and use it in GitHub Desktop.
在ubuntu16.04上安装nginx
# ubuntu16.04 nginx安装
wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
deb http://nginx.org/packages/ubuntu/ xenial nginx
deb-src http://nginx.org/packages/ubuntu/ xenial nginx
sudo apt-get update
sudo apt-get install nginx
vhost 实现多域名映射
upstream 实现反向代理
在/etc/nginx/conf.d依次为每一个域名加入配置文件
例子:
demo.conf
upstream demo {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name demo.com;
#charset koi8-r;
access_log /var/log/nginx/demo.access.log main;
error_log /var/log/nginx/demo.error.log info;
location / {
proxy_pass http://demo;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment