server {
    listen 80;
    server_name api.pathshalaa.in;
    root /var/www/html/pathshalaa_api/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

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

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }


    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
	fastcgi_read_timeout 3600;    
}

    location ~ /\.(?!well-known).* {
        deny all;
    }

    access_log /var/log/nginx/api.pathshalaa.dev-access.log combined;
    error_log  /var/log/nginx/api.pathshalaa.dev-error.log error;



    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/api.pathshalaa.in/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/api.pathshalaa.in/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}



#server {
#    listen 90;
#    server_name 193.203.161.62;
#    root /var/www/html/laravel_application/public;
#
#    index index.html index.htm index.php;
#
#    add_header X-Frame-Options "SAMEORIGIN";
#    add_header X-Content-Type-Options "nosniff";
#    
#    charset utf-8;
#    location = /favicon.ico { access_log off; log_not_found off; }
#    location = /robots.txt  { access_log off; log_not_found off; }
#
#    access_log /var/log/nginx/laravel.dev-access.log combined;
#    error_log  /var/log/nginx/laravel.dev-error.log error;



#    location / {
#        try_files $uri $uri/ =404;
#    }

#location ~ \.php$ {
#        fastcgi_split_path_info ^(.+\.php)(/.+)$;
#        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
#        fastcgi_index index.php;
#        include fastcgi_params;
#    }

#    location ~ \.php$ {
#	include snippets/fastcgi-php.conf;
#	fastcgi_pass unix:/run/php/php7.4-fpm.sock;
#   }

#    location ~ /\.ht {
#        deny all;
#    }

#    location ~ /\.(?!well-known).* {
#        deny all;
#    }
#}

server {
    if ($host = api.pathshalaa.in) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name api.pathshalaa.in;
    return 404; # managed by Certbot


}
