• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Using Nginx

psx

Active member
#1
Can someone post the config to not allow anyone to internal_data and library (I think its these two)?
 

psx

Active member
#3
Also when I try to put the rewrite it comes up with this error:

Code:
Configuration test failed!
nginx: [emerg] duplicate location "/" in /etc/nginx/sites-enabled/default:7
nginx: configuration file /etc/nginx/nginx.conf test failed\nroot@server:~#
 

Tracy Perry

Well-known member
#4
Also when I try to put the rewrite it comes up with this error:

Code:
Configuration test failed!
nginx: [emerg] duplicate location "/" in /etc/nginx/sites-enabled/default:7
nginx: configuration file /etc/nginx/nginx.conf test failed\nroot@server:~#
Send me your current nginx vhost configuration in a conversation and I'll take a look at it and see if I can figure it out.
 

psx

Active member
#5
Nginx starts running when I add the /xf/ but I don't have a /xf/ directory


location /xf/ {
try_files $uri $uri/ /index.php?$uri&$args;
index index.php index.html;
}
 

Laric

Active member
#6
Put that part into your other definition of
Code:
location / {
}
Do not create a new section of location / as that is not allowed within the same server definition.
 

Tracy Perry

Well-known member
#7
Put that part into your other definition of
Code:
location / {
}
Do not create a new section of location / as that is not allowed within the same server definition.
He's up and running... took a little while and his server configuration doesn't play as nicely as I'd like - but we were able to get it worked out.
 

psx

Active member
#8
Here's my config:

Code:
server {
listen 80 default;
server_name example.com;
root /var/www/html/;
include php;

location / {                             <--- This doesn't work, it says duplicate but when I put a directory Nginx runs.
try_files $uri $uri/ /index.php?$uri&$args;
index index.php index.html;
}

location /internal_data/ {
internal;
}
location /library/ {
internal;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
# Cloudflare

set_real_ip_from 204.93.240.0/24;
set_real_ip_from 204.93.177.0/24;
set_real_ip_from 199.27.128.0/21;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2405:8100::/32;
real_ip_header CF-Connecting-IP;