Skip to content

Instantly share code, notes, and snippets.

@olliebun
Created December 14, 2015 00:08
Show Gist options
  • Save olliebun/3687dd32174aa2f84090 to your computer and use it in GitHub Desktop.
Save olliebun/3687dd32174aa2f84090 to your computer and use it in GitHub Desktop.
Script to create a vhost that simulates Consumers API index from a static file.
# create and symlink the vhost
cat > /etc/nginx/sites-available/consumers-test <<EOF
server {
listen 80; ssl off;
listen 443 ssl;
server_name consumers-test;
ssl_certificate /etc/ssl/certs/2018-07-08-star.staging.learnosity.com.chain;
ssl_certificate_key /etc/ssl/private/2018-07-08-star.staging.learnosity.com.key;
ssl_client_certificate /etc/ssl/ca_certs/learnosity-ca.pem;
ssl_crl /etc/ssl/ca_certs/learnosity-ca.crl;
ssl_session_timeout 5m;
access_log /var/log/nginx/access_consumers-test.log ;
error_log syslog:server=localhost,facility=local0;
location / {
root /srv/www/consumers-test;
}
}
EOF
# set up the directory to service from
mkdir /srv/www/consumers-test/
curl consumers.learnosity.com > /srv/www/consumers-test/index.html
chown -R www-data:www-data
# reload nginx
service nginx reload
# then hit it
curl $ELB_ADDRESS -H "Host: consumers-test"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment