Welcome! Log In Create A New Profile

Advanced

The relative path to the Windows root folder

Posted by dutlamata 
The relative path to the Windows root folder
January 31, 2024 09:23AM
Hello. I would like to advise how I can change the root entry in nginx.conf in Windows so that it does not load the www folder, which is located in the "nginx" folder, but refers to the folder one level higher?
I need this to be specified as a relative path because the location where nginx is started from changes with the www folder which is located one level up.

Normally situation:

app: data/web/nginx
webfiles: data/web/nginx/www

i wanted solution for:

app: data/web/nginx
webfiles: data/web/www

With php config.

My nginx.conf:

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

client_max_body_size 200M;




server {
listen 80;
listen [::]:80;
server_name localhost;

root www;
index index.php index.html index.htm;

location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
log_not_found off;
}

location /comp/ {
try_files $uri $uri/ /comp/index.php;
}

location /backups {
deny all;
return 404;
}

location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
}


# Errors

error_page 404 /404.php;
error_page 500 502 503 504 /50x.php;
location = /50x.php {
root www;
}


}


server {
listen 80;
listen [::]:80;

server_name pma.*;

location / {
root phpMyAdmin;
index index.php index.html index.htm;
try_files $uri $uri/ =404;
}

location ~ \.php$ {
root phpMyAdmin;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}
}
}
Re: The relative path to the Windows root folder
February 15, 2024 07:04AM
Please
Re: The relative path to the Windows root folder
February 15, 2024 07:15AM
server {
listen ....;
[...]
root 'h:/websites/www.yoursite.com';
location /items/ { # adds to root setting
try_files $uri $uri/ =404;
[...]
}
}

In php.ini you have stuff like,

[PATH=H:/Websites/www.yoursite.com]
open_basedir = H:/Websites/www.yoursite.com
doc_root = H:/Websites/www.yoursite.com

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: The relative path to the Windows root folder
February 15, 2024 07:18AM
"H:/Websites/www.yoursite.com"

is absolute path

i want solution as relative path... for example as:

"../web/"
Re: The relative path to the Windows root folder
February 15, 2024 07:50AM
Use root set abs path, anything else will be relative to abs.

https://nginx.org/en/docs/http/ngx_http_core_module.html#root

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 109
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready