Merhabalar,
kullanmış olduğum scriptte root klasörü belirtmem gerekiyor. buda /var/www/html/web içersinde ve beliirtiyorum.
siteadi.com giriş yapınca web klasoru root oluyor. siteadi.com/belge/ bölümüne gidilginde ise var/www/html/belge klasörüne gidilip oradaki php dosyasını çalıştırmak istiyorum. Nasıl yapabilirim?
server {
root /var/www/html/web;
index index.html index.htm index.nginx-debian.html;
server_name siteadi.com www.siteadi.com;
location / {
try_files $uri /app.php$is_args$args;
}
location ~ ^/(app_dev|config)\.php(/|$) {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
# PROD
location ~ ^/app\.php(/|$) {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/siteadi.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/siteadi.com/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
add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot
ssl_trusted_certificate /etc/letsencrypt/live/siteadi.com/chain.pem; # managed by Certbot
ssl_stapling on; # managed by Certbot
ssl_stapling_verify on; # managed by Certbot
}
server {
if ($host = siteadi.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
root /var/www/html/web;
index index.html index.htm index.nginx-debian.html;
server_name siteadi.com www.siteadi.com;
location / {
try_files $uri $uri/ =404;
}
}