Using Nginx

psx

Active member
Can someone post the config to not allow anyone to internal_data and library (I think its these two)?
 
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:~#
 
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.
 
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;
}
 
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.
 
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.
 
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;
 
Back
Top Bottom