nginx

# ADD CERTIFICATE AND KEY
server {
    listen   443;
    ssl    on;
    ssl_certificate        /etc/nginx/pki/chain.crt;
    ssl_certificate_key    /etc/nginx/pki/www.alexlinux.com.key;
    server_name www.alexlinux.com;
    location / {
        root   /usr/share/nginx/html;
        index  index.html;
    }
}

# TCP BALANCER
stream {
    upstream pop3 {
        server host004.tts.loc:110;
        server host005.tts.loc:110;
        server host006.tts.loc:110;
    }

    server {
        listen 110;
        proxy_pass pop3;
    }
}

# REDIRECT TO DOCKER CONTAINER
server {
  listen       80;
  server_name  alexlinux.com;
  root         /usr/share/nginx/html;
  index        index.php;
  location / {
    proxy_pass http://127.0.0.1:4444;
    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;
  }
}
# /prices -> /index.php?_url=/prices
rewrite ^(.*)$ /index.php?_url=$1;
# CUT FROM URI

https://alexlinux.com/foo/login/success?token=123

->

https://alexlinux.com/login/success?token=123

location ^~ /foo {
    rewrite ^/foo(.*)$ $1 permanent;
}
# https://github.com/garakh/kladrapi
location / {
    if (!-e $request_filename){
    rewrite ^(.*)$ /index.php?_url=$1;
    }
}

location ~ \.php$ {
    fastcgi_pass  127.0.0.1:9000;
    fastcgi_index /index.php;

    include fastcgi_params;
    fastcgi_split_path_info       ^(.+\.php)(/.+)$;
    fastcgi_param PATH_INFO       $fastcgi_path_info;
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
    fastcgi_param SCRIPT_FILENAME $document_root/index.php;
}

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>