forked from jtt-berkeley/AirBnB_clone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0-setup_web_static.sh
executable file
·51 lines (45 loc) · 1.31 KB
/
0-setup_web_static.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# Set the static site live
sudo apt-get -y install nginx
sudo mkdir -p /data/web_static/releases/test
sudo mkdir /data/web_static/shared
sudo echo 'Testing...' | sudo tee /data/web_static/releases/test/index.html > /dev/null
sudo ln -sf /data/web_static/releases/test /data/web_static/current
sudo chown -R ubuntu:ubuntu /data/
sudo echo 'user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
server {
listen 80;
server_name localhost;
location / {
root /home;
}
location /hbnb_static/ {
alias /data/web_static/current/;
}
error_page 404 /404.html;
location = /404.html {
root /home;
}
location /redirect_me {
rewrite ^/redirect_me http://www.youtube.com/watch?v=QH2-TGUlwu4 permanent;
}
}
}' | sudo tee /etc/nginx/nginx.conf > /dev/null
sudo service nginx restart