argamanza
5/21/2019 - 11:19 AM

nginx.conf

user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
    worker_connections 1024;
}
http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    log_format main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log /var/log/nginx/access.log  main;
    server {
        listen 80;
        server_name hbsfc.co.il;
        location / {
            return 301 https://$host$request_uri;
        }
    }
    server {
        listen 443;
        root /usr/share/nginx/html;
        index index.php index.html index.htm;
        server_name hbsfc.co.il;
        ssl on;
        ssl_certificate /etc/nginx/certs/server.crt;
        ssl_certificate_key /etc/nginx/certs/server.key;
        location / {
            try_files $uri $uri/ /index.html;
        }
        location = /50x.html {
            root /usr/share/nginx/html;
        }
        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;
    }
}