server {
    listen       80;
    listen       [::]:80;
    server_name  app.551.com.tw;
    return 301 https://$host$request_uri;
}

server {
        listen 443 ssl;
        listen [::]:443 ssl;
	root /home/Sites/apps/app/;
        index index.php index.html index.htm;
        ssl_certificate /etc/ssl/star.551.com.tw.crt;
        ssl_certificate_key /etc/ssl/star.551.com.tw.key;
        server_name app.551.com.tw;
	access_log /var/log/nginx/app.log;

        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }

        location ~ \.php$ {
                try_files $uri /index.php =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass php74:9001;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }

    	location /551backend {
        	auth_basic "Restricted Content";
         	auth_basic_user_file /etc/nginx/.htpasswd;
    	}
}
