Last active
August 29, 2015 14:21
-
-
Save ajoyoommen/e0e244a473fc7104d434 to your computer and use it in GitHub Desktop.
Prepare Amazon AMI for Django, NGINX, PostgreSQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo yum install nginx htop git gcc | |
ssh-keygen | |
sudo yum install postgresql93 postgresql93-devel postgresql93-server python27-devel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo service postgresql initdb | |
sudo nano /var/lib/pgsql9/data/pg_hba.conf # Replace peer with trust | |
sudo service postgresql restart | |
sudo psql -U postgres | |
ALTER USER postgres WITH PASSWORD 'securepass'; | |
sudo nano /var/lib/pgsql9/data/pg_hba.conf # Replace trust with md5 | |
sudo service postgresql restart | |
psql -U postgres # Login with 'securepass' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name try.domain.com; | |
access_log /var/log/nginx/domain.access.log main; | |
error_log /var/log/nginx/domain.error.log info; | |
location / { | |
proxy_pass http://127.0.0.1:8001; | |
proxy_set_header X-Forwarded-Host $server_name; | |
proxy_set_header X-Real-IP $remote_addr; | |
} | |
location /static { | |
alias /home/user/static; | |
} | |
error_page 404 /404.html; | |
location = /40x.html { | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment