-
Notifications
You must be signed in to change notification settings - Fork 5
Setup Nginx on Google Cloud
Faisal Ali Rabbani edited this page May 16, 2015
·
23 revisions
-
Update apt
sudo apt-get update ```
-
Install nginx
sudo apt-get install nginx ```
-
Get SSL-Certificate from provider.
-
Save .key and .pem in server
- ex:
/etc/nginx/ssl
- ex:
-
Add a new virtual host or edit default
-
Edit host file vim
/etc/nginx/sites-available/default -
Redirect http traffic to https
server { listen 80; return 301 https://$host$request_uri; } ```
-
Add ssl certificate
server {
listen 443;
ssl on; ssl_certificate /etc/nginx/ssl/<CERTIFICATE_PEM>; ssl_certificate_key /etc/nginx/ssl/<CERTIFICATE_KEY>;
server_name <DOMAIN_NAME>; #Redirect port application port to https location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Fix the “It appears that your reverse proxy set up is broken" error.
proxy_pass http://localhost:<APPLICATION_PORT>;
proxy_read_timeout 90;
proxy_redirect http://localhost:<APPLICATION_PORT> https://<DOMAIN_NAME>;
} } ```
-
Restart nginx
/etc/init.d/nginx restart ```
- Setup Jenkins on Google Cloud
- [Save a Jenkins VM image](Save a Jenkins VM image)
- [Load Jenkins Instance from Image](Load Jenkins Instance from Image)
- [Save a Node VM image](Save a Node VM image)
- [Load a VM from image](Load a VM from image)
- [Setup Nginx on Google Cloud](Setup Nginx on Google Cloud)
- Jenkins Job: Build and Deploy App locally
- Jenkins Job: Build and Deploy App remotely
- TBD