server { listen *:443; server_name localhost; root /var/www/html; index index.php index.html index.htm; ssl on; ssl_certificate ./certs/cert.pem; ssl_certificate_key ./certs/key.pem; error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } location /oauth/access_token { try_files $uri /oauth/index.php; } location /oauth/authorize { try_files $uri /oauth/authorize.php$is_args$args; } location ~ /oauth/.*\.php$ { try_files $uri =404; fastcgi_pass php:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location / { try_files $uri $uri/ =404; } } server { listen 80 default_server; server_name localhost; index index.php index.html index.htm; return 301 https://$host$request_uri; }