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

XF 1.2 Global RSS Feed - Location & NGINX Server Block

LPH

Well-known member
#1
I've moved the server from Apache to NGINX and noticed that the ragtek global feed stopped. I uninstalled it and am trying to get the default global feed.

This brought up a few questions.

1. Maybe I am not trying the correct location. What is the correct global feed location?
2. Maybe I have the NGINX server block for XenForo set wrong. Is there someone using NGINX that has a working global feed. What are you using?

Would someone mind checking to see if I'm just looking in the wrong place ? :)

www.tuxreports.com/community

Code:
  # XENFORO
  location /community/ {
  try_files $uri $uri/ /community/index.php?q=$uri&$args;
  }

  location ~ /community/(internal_data|library) {
  internal;
  }
 
Last edited:

LPH

Well-known member
#3
@Mike - thank you. I should have put the complete nginx.conf and default files up. Here is the latest revision.

Code:
user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
  worker_connections 2000;
  multi_accept on;
}

http {

  ##
  # Basic Settings
  ##

  open_file_cache max=200000 inactive=20s;
  open_file_cache_valid 30s;
  open_file_cache_min_uses 2;
  open_file_cache_errors on;

  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 65;
  types_hash_max_size 2048;
  # server_tokens off;

  server_names_hash_bucket_size 64;
  # server_name_in_redirect off;

  include /etc/nginx/mime.types;
  default_type application/octet-stream;

  ##
  # Logging Settings
  ##

  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log;

  ##
  # Gzip Settings
  ##

  gzip on;
  gzip_disable "msie6";

  gzip_vary on;
  gzip_proxied any;
  gzip_comp_level 2;
  gzip_buffers 16 8k;
  gzip_http_version 1.1;
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text$

  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;
}
Code:
server {
  listen 80;
  server_name www.tuxreports.com;

  root /path/to/files;
  index index.php index.html index.htm;

  access_log /path/www.tuxreports.com.access.log;
  error_log /path/nginx/www.tuxreports.com.error.log;

  location = /favicon.ico {
  log_not_found off;
  access_log off;
  }

  # ESSENTIAL : robots.txt
  location = /robots.txt {
  allow all;
  log_not_found off;
  access_log off;
  }

  # SECURITY : Deny all attempts to access hidden files .abcde
  location ~ /\. {
  deny all;
  }

  # PERFORMANCE : Set expires headers for static files and turn off logging.
  location ~* ^.+\.(js|css|swf|xml|txt|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|jpg|jpeg|gif|png|ico|zip|tgz|g$
  access_log off;
  log_not_found off;
  expires 30d;
  }

  # Front Page
  location / {
  try_files $uri $uri/ /index.php?q=$uri&$args;
  }

  # SECURITY : Deny all attempts to access PHP Files in the uploads directory
  location ~* /(?:uploads|files)/.*\.php$ {
  deny all;
  }

  # XENFORO
  location /community/ {
  try_files $uri $uri/ /community/index.php?q=$uri&$args;
  }

  location /community/data {
  location ~ \.html$ {
  internal;
  }
  internal;
  }

  location /community/internal_data {
  location ~ \.(data|html|php)$ {
  internal;
  }
  internal;
  }

  location /community/install {
  location ~ \.(css|php|xml)$ {
  internal;
  }
  internal;
  }

  location /community/library {
  location ~ \.(default|html|php|txt|xml)$ {
  internal;
  }
  internal;
  }


  location ~* \.(?:rss|atom)$ {
  expires 1h;
  add_header Cache-Control "public";
  }

  # MEDIAWIKI
  location /alv/ {
  index  index.php index.html;
  try_files $uri $uri /alv/index.php?query_string;
  }
  # MULTISITE Rewrite rules
  if (!-e $request_filename) {
  rewrite /wp-admin$ $scheme://$host$uri/ permanent;
  rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
  rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
  }

  #location /doc/ {
  #  alias /usr/share/doc/;
  #  autoindex on;
  #  allow 127.0.0.1;
  #  allow ::1;
  #  deny all;
  #}

  # CSS and Javascript
  location ~* \.(?:css|js)$ {
  expires 1y;
  access_log off;
  add_header Cache-Control "public";
  }

  error_page 404 /404.html;

  # REQUIREMENTS : Enable PHP Support
  location ~ \.php$ {
  # SECURITY : Zero day Exploit Protection
  try_files $uri =404;
  # ENABLE : Enable PHP, listen fpm sock
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  fastcgi_pass unix:/var/run/php5-fpm.sock;
  fastcgi_index index.php;
  include fastcgi_params;
  }
}
 
Last edited:

LPH

Well-known member
#4
@Mike - I actually saw that rss portion when I copied it for pasting and removed it. Restarted nginx and it global still fails. Did a server reboot in case cache was not clearing as I'd hoped... still a problem.

From error logs:
Code:
2013/12/20 13:42:12 [error] 995#0: *445 open() "/path/community/forums/latest-news-events.172/index.rss" failed (2: No such file or directory), client: xx, server: www.tuxreports.com, request: "GET /community/forums/latest-news-events.172/index.rss HTTP/1.1", host: "www.tuxreports.com", referrer: "http://www.tuxreports.com/community/"
 

Mike

XenForo developer
Staff member
#5
Based on http://wiki.nginx.org/HttpCoreModule#location, this appears to indicate that there's a rule matching the RSS URL in a regex. Because of how it processes location blocks, this is not triggering your location / block.

I can only presume something else is matching it, as nginx simply isn't sending the request to XF.
 

LPH

Well-known member
#6
Thank you for the help. I've been doing too much copy paste and not enough thinking/reading. This is my plan for moving forward. Please let me know if you'd make any adjustments.

Approach: Divide and conquer:;Split the default file apart to track down the problem.

1. build just a basic default file with the index and server name. Test.
2. Add a xenforo location block and include it into the default. Test

-- if fails
panic. relax and read the file, read the error logs, think :)

-- If works
3. build a WordPress location block and include it .... Test
-- if fails
then know that there is a conflict at this point.
-- if works
4. Add each location block, one at a time, test in between until there is a failure....
 

LPH

Well-known member
#7
The conflict was here:

Code:
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}
 

LPH

Well-known member
#9
I assumed that was the rss portion you removed before...
Sorry. I removed the rss|atom part. I rearranged the configuration file [based on the plan posted] before getting to the point that the nginx wouldn't start when those lines were enabled. I'm still struggling with understanding the documents .. but that's another story.... configuration D & E explanation is not clear.

Again - thank you for the help. Your guidance put me in the right direction.