server {
listen 80 default_server;
server_name example.org;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl default_server;
ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem;
root /home/deploy/apps/example/current/public;
try_files $uri/index.html $uri @example;
location @example {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://example;
}
keepalive_timeout 10;
}
server {
listen 80 ;
server_name example_no_ssl.org;
location / {
......
}
.....
}
upstream gitlab-app {
least_conn;
server server_addr_or_ip:80 weight=10 max_fails=3 fail_timeout=30s;
}
location /gitlab {
proxy_pass http://gitlab-app;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
const(
EVE_ICON_SOURCE = "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAY...."
ICON_PATH = "/tmp/eve.png"
)
// Check and export icon file from source
func iconExport() {
var _, err = os.Stat(ICON_PATH)
// Check exist icon file
if os.IsNotExist(err) {
// iconfile exist? Create
file, err := os.Create(ICON_PATH)
checkError(err)
defer file.Close()
// Open new iconfile
iconFile, err := os.OpenFile(ICON_PATH, os.O_RDWR, 0644)
checkError(err)
defer iconFile.Close()
// Decode Base64 string in bytecode
iconSource, err := base64.StdEncoding.DecodeString(EVE_ICON_SOURCE)
checkError(err)
// Write bew icon
_, err = iconFile.Write(iconSource)
checkError(err)
iconFile.Close()
}
}