docs: Add nginx configuration dan fix 404 routing issue
This commit is contained in:
63
nginx.conf.example
Normal file
63
nginx.conf.example
Normal file
@@ -0,0 +1,63 @@
|
||||
# Nginx Configuration untuk Slim Framework 4
|
||||
# Copy ke: /www/server/panel/vhost/nginx/api.btekno.cloud.conf
|
||||
# Atau setup via aaPanel: Website -> api.btekno.cloud -> Settings -> Configuration
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen 443 ssl http2;
|
||||
server_name api.btekno.cloud;
|
||||
|
||||
# SSL Configuration (setup via aaPanel)
|
||||
# ssl_certificate /path/to/cert;
|
||||
# ssl_certificate_key /path/to/key;
|
||||
|
||||
# Document Root - PENTING: harus ke folder public/
|
||||
root /www/wwwroot/api.btekno.cloud/api/public;
|
||||
index index.php index.html;
|
||||
|
||||
# Logs
|
||||
access_log /www/wwwlogs/api.btekno.cloud.log;
|
||||
error_log /www/wwwlogs/api.btekno.cloud.error.log;
|
||||
|
||||
# Disable access to hidden files
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
# Main location block
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
# PHP-FPM configuration
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass unix:/tmp/php-cgi-83.sock; # Sesuaikan dengan PHP version
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
|
||||
# Disable buffering for SSE
|
||||
fastcgi_buffering off;
|
||||
}
|
||||
|
||||
# Disable PHP execution in uploads
|
||||
location ~* /uploads/.*\.php$ {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
|
||||
# Gzip compression
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_min_length 1024;
|
||||
gzip_types text/plain text/css text/xml text/javascript application/json application/javascript application/xml+rss;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user