MyBB Community Forums

Full Version: Google SEO NGINX Error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
404 Not Found

nginx/1.10.1



That's the error I get when viewing threads/categories/users/etc
NGINX servers require a different type of rewrite rules file (eg. .htaccess)
see more details => rewrite-nginx.txt
(2016-11-14, 08:32 AM).m. Wrote: [ -> ]NGINX servers require a different type of rewrite rules file (eg. .htaccess)
see more details => rewrite-nginx.txt

Added it to nginx.conf, came out with the error when trying to restart nginx:

nginx: [emerg] "location" directive is not allowed here in /etc/nginx/nginx.conf:17
nginx: configuration file /etc/nginx/nginx.conf test failed

File looked like:

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections  1024;
}

http {
    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  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

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

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;
    
    client_max_body_size 100M;
    
    
}

location / {
    # ...your location settings are here...

    rewrite ^/forum-([0-9]+)\.html$ /forumdisplay.php?fid=$1;
    rewrite ^/forum-([0-9]+)-page-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2;
    rewrite ^/thread-([0-9]+)\.html$ /showthread.php?tid=$1;
    rewrite ^/thread-([0-9]+)-page-([0-9]+)\.html$ /showthread.php?tid=$1&page=$2;
    rewrite ^/thread-([0-9]+)-lastpost\.html$ /showthread.php?tid=$1&action=lastpost;
    rewrite ^/thread-([0-9]+)-nextnewest\.html$ /showthread.php?tid=$1&action=nextnewest;
    rewrite ^/thread-([0-9]+)-nextoldest\.html$ /showthread.php?tid=$1&action=nextoldest;
    rewrite ^/thread-([0-9]+)-newpost\.html$ /showthread.php?tid=$1&action=newpost;
    rewrite ^/thread-([0-9]+)-post-([0-9]+)\.html$ /showthread.php?tid=$1&pid=$2;

    rewrite ^/post-([0-9]+)\.html$ /showthread.php?pid=$1;

    rewrite ^/announcement-([0-9]+)\.html$ /announcements.php?aid=$1;

    rewrite ^/user-([0-9]+)\.html$ /member.php?action=profile&uid=$1;

    rewrite ^/calendar-([0-9]+)\.html$ /calendar.php?calendar=$1;
    rewrite ^/calendar-([0-9]+)-year-([0-9]+)\.html$ /calendar.php?action=yearview&calendar=$1&year=$2;
    rewrite ^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ /calendar.php?calendar=$1&year=$2&month=$3;
    rewrite ^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ /calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4;
    rewrite ^/calendar-([0-9]+)-week-(n?[0-9]+)\.html$ /calendar.php?action=weekview&calendar=$1&week=$2;

    rewrite ^/event-([0-9]+)\.html$ /calendar.php?action=event&eid=$1;
}
If all you know is copy & paste, then nginx is not the right choice for you.

You put it in the wrong file at the wrong place and even copied this part "# ...your location settings are here...".

nginx has a documentation and wiki, you can go over there and learn how it works or you can just go back to Apache.
(2016-11-14, 11:35 AM)frostschutz Wrote: [ -> ]If all you know is copy & paste, then nginx is not the right choice for you.

You put it in the wrong file at the wrong place and even copied this part "# ...your location settings are here...".

nginx has a documentation and wiki, you can go over there and learn how it works or you can just go back to Apache.

Well how do I reset it back to normal then? I get the 404 error even after I uninstalled the plugin. I'll have my host set it all up when I have time to get online and communicate with them