Welcome! Log In Create A New Profile

Advanced

change root

Posted by nginxjunkie 
change root
April 28, 2014 10:07AM
Hmm.. I cannot make nginx change the root directory in default.conf it's not working
Re: change root
April 28, 2014 11:48AM
Really doesn't anyone know why i can't change the website root directory in default.conf using Centos?!
Re: change root
April 28, 2014 11:54AM
'root' can be set just about anywhere, just use it.

root /bla/path/somewhere
.....
root /bla/path/somewhereelse
.....
Re: change root
April 28, 2014 12:27PM
Ok. Thanks. I've tried that for like 20h. I tried changing to root /var/www/musibox.se

In the end nginx could not serve any php files when I did. The only way it works is by using root /usr/shares/nginx/html

weird?
Re: change root
April 28, 2014 12:44PM
No its not weird, php like RoR are independent systems from nginx, so when you tell nginx to change root you need to tell php as well where root has gone to, or define a rootbase, add it to the passing parameters from nginx.

nginx, root: /bla/bla2/bla3
php, root /bla/bla2/bla3

nginx, change root: /bla/bla2/bla4
php, root /bla/bla2/bla3 (huh?)

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: change root
April 28, 2014 12:48PM
wire your account no. sir!
Re: change root
May 19, 2014 09:53AM
I can't change the root path of my nginx.conf file.

I have installed nginx on mac os with passenger using home-brew. But its impossible to change the root path of my rails app. Nginx keeps saying:

nginx: [emerg] invalid number of arguments in "root" directive in /opt/nginx/conf/nginx.conf:46

the nginx.conf file is:

#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 {

passenger_root /Users/gabrielmadeira/.rvm/gems/ruby-2.1.0@global/gems/passenger-4.0.42;

passenger_ruby /Users/gabrielmadeira/.rvm/gems/ruby-2.1.0@filx/wrappers/ruby;

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;

server {

listen 80;

server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {

root /Users/gabrielmadeira/Google Drive/Apps/Rep/public;

index index.html index.htm;

passenger_enabled on;

rails_env development;

}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html

#

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80

#

# location ~ .php$ {

# proxy_pass http://127.0.0.1;

#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

}

}

Can anyone help please ?
Re: change root
May 19, 2014 10:39AM
Use quotes around a path which contains spaces.

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

Click here to login

Online Users

Guests: 163
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready