[Nginx] Enabling Search Engine Friendly URLs
#21
Hi,

Google SEO URL Settings on nginx not working

My Nginx.conf settings and I'm using VestaCP on vps centos 6 x64

server {
	listen 80;
    return 301 https://$host$request_uri;
}
server {
    listen      teknopunch.com:443 ssl http2;
    server_name teknopunch.com www.teknopunch.com;
    root        /home/admin/web/teknopunch.com/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/teknopunch.com.log combined;
    access_log  /var/log/nginx/domains/teknopunch.com.bytes bytes;
    error_log   /var/log/nginx/domains/teknopunch.com.error.log error;

    location / {
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
			
        }

rewrite ^/forum-([0-9]+).html$ /forumdisplay.php?fid=$1 last;
rewrite ^/forum-([0-9]+)-page-([0-9]+).html$ /forumdisplay.php?fid=$1&page=$2 last;
rewrite ^/thread-([0-9]+).html$ /showthread.php?tid=$1 last;
rewrite ^/thread-([0-9]+)-page-([0-9]+).html$ /showthread.php?tid=$1&page=$2 last;
rewrite ^/thread-([0-9]+)-lastpost.html$ /showthread.php?tid=$1&action=lastpost last;
rewrite ^/thread-([0-9]+)-nextnewest.html$ /showthread.php?tid=$1&action=nextnewest last;
rewrite ^/thread-([0-9]+)-nextoldest.html$ /showthread.php?tid=$1&action=nextoldest last;
rewrite ^/thread-([0-9]+)-newpost.html$ /showthread.php?tid=$1&action=newpost last;
rewrite ^/thread-([0-9]+)-post-([0-9]+).html$ /showthread.php?tid=$1&pid=$2 last;
rewrite ^/post-([0-9]+).html$ /showthread.php?pid=$1 last;
rewrite ^/announcement-([0-9]+).html$ /announcements.php?aid=$1 last;
rewrite ^/user-([0-9]+).html$ /member.php?action=profile&uid=$1 last;
rewrite ^/calendar-([0-9]+).html$ /calendar.php?calendar=$1 last;
rewrite ^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+).html$ /calendar.php?calendar=$1&year=$2&month=$3 last;
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 last;
rewrite ^/calendar-([0-9]+)-week-(n?[0-9]+).html$ /calendar.php?action=weekview&calendar=$1&week=$2 last;
rewrite ^/event-([0-9]+).html$ /calendar.php?action=event&eid=$1 last;


        location ~ [^/]\.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9001;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
        }
    }
	# Note: You are able to choose a different name in the Admin CP. If you've done that you need to change it here too
location ~ /error.log 
{ 
    deny all; 
}

# Note: You are able to rename the admin directory. If you've done that, you need to change it here too
location /admin/backups {
    deny all;
}

    error_page  403 /error/404.html;
    error_page  404 /error/404.html;
    error_page  500 502 503 504 /error/50x.html;

    location /error/ {
        alias   /home/admin/web/teknopunch.com/document_errors/;
    }

    location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;
    }

    location /vstats/ {
        alias   /home/admin/web/teknopunch.com/stats/;
        include /home/admin/web/teknopunch.com/stats/auth.conf*;
    }

    include     /etc/nginx/conf.d/phpmyadmin.inc*;
    include     /etc/nginx/conf.d/phppgadmin.inc*;
    include     /etc/nginx/conf.d/webmail.inc*;

    include     /home/admin/conf/web/nginx.teknopunch.com.conf*;
}

how do it work? I am constantly receiving 404 error
There needs to be a solution to this The url settings are not working at nginx at all
Hüseyin Körbalta - kişisel blog | Twitter: @huseyinkorbalta
Reply
#22
Your location for the redirect's are wrong, additional you should read something about Nginx Pitfalls.
https://www.nginx.com/resources/wiki/sta..._pitfalls/

You have something from them in your configuration.
Additional you should change:
listen teknopunch.com:443 ssl http2;
to your ip
listen 123.123.123.123:443 ssl http2;


The Url should be set from server name not from listen.


I remodeled your config, how it should be, can not garantie if it works with your CP. But you can try it. (Make a backup before)
upstream php-fpm-teknopunch {
  server 127.0.0.1:9001;
}

server {
  listen 123.123.123.123:80;
  server_name teknopunch.com www.teknopunch.com;
  return 301 https://$server_name$request_uri;
}

server {
  listen 123.123.123.123:443 ssl http2;
  server_name teknopunch.com www.teknopunch.com;

  root /home/admin/web/teknopunch.com/public_html;
  index index.php;

  access_log /var/log/nginx/domains/teknopunch.com.log combined;
  access_log /var/log/nginx/domains/teknopunch.com.bytes bytes;
  error_log /var/log/nginx/domains/teknopunch.com.error.log error;

  if ($http_user_agent ~* (HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) ) {
    return 444;
  }

  if ($http_user_agent = "") { return 444; }
  if ($http_user_agent = " ") { return 444; }
  if ($http_user_agent = "-") { return 444; }

  if ($http_user_agent ~* (Baiduspider|webalta|nikto|wkito|pikto|scan|acunetix|morfeus|webcollage|youdao) ) {
    return 444;
  }

  if ($http_user_agent ~* "PHP|curl|Wget|HTTrack|Nmap|Verifying|PingBack|Pingdom|Joomla|Wordpress") {
    return 444;
  }
  
  location / {
    #####
    # MyBB integrated seo url schema
    #####
    
    #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$
    #rewrite ^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ /calendar.php?calendar=$1&year=$
    #rewrite ^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ /calendar.php?acti$
    #rewrite ^/calendar-([0-9]+)-week-(n?[0-9]+)\.html$ /calendar.php?action=weekview&calendar=$1&we$

    #rewrite ^/event-([0-9]+)\.html$ /calendar.php?action=event&eid=$1;


    #####
    # MyBB Google SEO Plugin url schema
    #####
    rewrite ^/([^&]*)&(.*)$ https://www.emo-treff.de/$1?$2 permanent;
    rewrite ^/((?i)sitemap-([^./]+)\.xml)$ /misc.php?google_seo_sitemap=$2;
    rewrite ^/((?i)Forum-([^./]+))$ /forumdisplay.php?google_seo_forum=$2;
    rewrite ^/((?i)Thread-([^./]+))$ /showthread.php?google_seo_thread=$2;
    rewrite ^/((?i)Announcement-([^./]+))$ /announcements.php?google_seo_announcement=$2;
    rewrite ^/((?i)User-([^./]+))$ /member.php?action=profile&google_seo_user=$2;
    rewrite ^/((?i)Calendar-([^./]+))$ /calendar.php?google_seo_calendar=$2;
    rewrite ^/((?i)Event-([^./]+))$ /calendar.php?action=event&google_seo_event=$2;

    try_files $uri $uri/ /index.php$uri?$args;
  }

  location ~ "^(.+\.php)($|/)" {
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_index index.php;

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param SERVER_NAME $host;

    if ($uri !~ "^/uploads/") {
      fastcgi_pass php-fpm-teknopunch;
    }
    include fastcgi_params;
  }

  location ~* \.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
    expires max;
    log_not_found off;
    access_log off;
  }

  location ~* \.(html|htm)$ {
    expires 30m;
  }

  location ~ /uploads/avatars {
    deny all;
  }

  location ~ /\.git {
    deny all;
  }

  location ~ /README.md {
    deny all;
  }

  location ~ /\.gitignore {
    deny all;
  }

  location ~* /\.(ht|git|svn) {
    deny all;
  }

  location /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
  }

  # Note: You are able to choose a different name in the Admin CP. If you've done that you need to change it here too
  location ~ /error.log {
    deny all;
  }

  # Note: You are able to rename the admin directory. If you've done that, you need to change it here too
  location /admin/backups {
    deny all;
  }

  error_page  403 /error/404.html;
  error_page  404 /error/404.html;
  error_page  500 502 503 504 /error/50x.html;

  location /error/ {
    alias   /home/admin/web/teknopunch.com/document_errors/;
  }

  location ~* "/\.(htaccess|htpasswd)$" {
    deny all;
    return 404;
  }

  location /vstats/ {
    alias   /home/admin/web/teknopunch.com/stats/;
    include /home/admin/web/teknopunch.com/stats/auth.conf*;
  }

  include     /etc/nginx/conf.d/phpmyadmin.inc*;
  include     /etc/nginx/conf.d/phppgadmin.inc*;
  include     /etc/nginx/conf.d/webmail.inc*;

  include     /home/admin/conf/web/nginx.teknopunch.com.conf*;
}

You can switch in this config between MyBB SEO schema or Google SEO schema
Paid support or developement: www.broatcast-consulting.de
All other: blog.broatcast.de

[Image: EbbMWfN.png]

Reply
#23
(2017-09-04, 03:15 PM)broatcast Wrote: ......
Hello again,thanks for replying.

But,
URL redirection is not wrong, nginx will not compile if it is wrong. However, the rewrite codes you give do not work at all, so even if you add it to the right, it returning a 404 error.

I tried using the Google SEO plugin but again the result was a 404 error.
Hüseyin Körbalta - kişisel blog | Twitter: @huseyinkorbalta
Reply
#24
Did you applied the core modification over the plugin overview for google seo plugin?


Did you replace the whole config with that i give you? Or just replacing parts? I recall you have a pitfall....

The code you posted above is for mybb internal seo rewrite not for the google seo plugin, so please clarify a little bit, you like to use mybb internal? then change it in the config i give to you, if you use google seo plugin you need to apply core changes.

The config work on all my mybb installations and different servers. replace the whole config not only 1 part if you have a pitfall its worth nothing if you dont fix the pitfall.
Paid support or developement: www.broatcast-consulting.de
All other: blog.broatcast.de

[Image: EbbMWfN.png]

Reply
#25
You can also enable the "Enable search engine friendly URLs in Archive?" option - it's the option under the "Enable search engine friendly URLs?".

If you decide to enable just the "Enable search engine friendly URLs?" option you can use the following nginx rewrite rules:

rewrite ^/forums/forum-([0-9]+)\.html$ /forums/forumdisplay.php?fid=$1;
rewrite ^/forums/forum-([0-9]+)-page-([0-9]+)\.html$ /forums/forumdisplay.php?fid=$1&page=$2;
rewrite ^/forums/thread-([0-9]+)\.html$ /forums/showthread.php?tid=$1;
Reply
#26
(2017-09-04, 06:07 PM)broatcast Wrote: Did you applied the core modification over the plugin overview for google seo plugin?


Did you replace the whole config with that i give you? Or just replacing parts? I recall you have a pitfall....

The code you posted above is for mybb internal seo rewrite not for the google seo plugin, so please clarify a little bit, you like to use mybb internal? then change it in the config i give to you, if you use google seo plugin you need to apply core changes.

The config work on all my mybb installations and different servers. replace the whole config not only 1 part if you have a pitfall its worth nothing if you dont fix the pitfall.

First I tried with google seo plugin but I got 404 error again.
Later I tried mybb default self-url settings and it gave the same error.


(2017-09-04, 06:13 PM)vijay.thakor Wrote: You can also enable the "Enable search engine friendly URLs in Archive?" option - it's the option under the "Enable search engine friendly URLs?".

If you decide to enable just the "Enable search engine friendly URLs?" option you can use the following nginx rewrite rules:

rewrite ^/forums/forum-([0-9]+)\.html$ /forums/forumdisplay.php?fid=$1;
rewrite ^/forums/forum-([0-9]+)-page-([0-9]+)\.html$ /forums/forumdisplay.php?fid=$1&page=$2;
rewrite ^/forums/thread-([0-9]+)\.html$ /forums/showthread.php?tid=$1;

Before using the Google seo plugin, I tried mybb default url structure and enabled the self url part, but the result was again 404 error.
Hüseyin Körbalta - kişisel blog | Twitter: @huseyinkorbalta
Reply
#27
I still have the feeling you mix the things .... can you post your actualy conf file. And tell us if you use the seo plugin or not. if you unclear "uninstall" it by just deleting the files, without reverting the core modifications, you messed up your core files.
Paid support or developement: www.broatcast-consulting.de
All other: blog.broatcast.de

[Image: EbbMWfN.png]

Reply
#28
The Google seo plugin is currently disabled and I changed the functions.php file that you over with the original again. Everything is normal

Right now I'm using mybb default self-url.

Also I'm using Centos 6 x64 bit and VestaCP kontrol panel. And VestaCP default nginx.conf file below
server {
listen 80;
    return 301 https://$host$request_uri;
}
server {
    listen      teknopunch.com:443 ssl http2;
    server_name teknopunch.com www.teknopunch.com;
    root        /home/admin/web/teknopunch.com/public_html;
    access_log  /var/log/nginx/domains/teknopunch.com.log combined;
    access_log  /var/log/nginx/domains/teknopunch.com.bytes bytes;
    error_log   /var/log/nginx/domains/teknopunch.com.error.log error;
		
		
location / {
		
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
			log_not_found off;
        }
		location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }
		
		
		
        location ~ [^/]\.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9001;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
        }
    }
    error_page  403 /error/404.html;
    error_page  404 /error/404.html;
    error_page  500 502 503 504 /error/50x.html;

    location /error/ {
        alias   /home/admin/web/teknopunch.com/document_errors/;
    }

    location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;
    }

    location /vstats/ {
        alias   /home/admin/web/teknopunch.com/stats/;
        include /home/admin/web/teknopunch.com/stats/auth.conf*;
    }

    include     /etc/nginx/conf.d/phpmyadmin.inc*;
    include     /etc/nginx/conf.d/phppgadmin.inc*;
    include     /etc/nginx/conf.d/webmail.inc*;

    include     /home/admin/conf/web/nginx.teknopunch.com.conf*;
}

And the process I'm doing in this file is as follows

server {
	listen 80;
    return 301 https://$host$request_uri;
}
server {
    listen      teknopunch.com:443 ssl http2;
    server_name teknopunch.com www.teknopunch.com;
    root        /home/admin/web/teknopunch.com/public_html;
    access_log  /var/log/nginx/domains/teknopunch.com.log combined;
    access_log  /var/log/nginx/domains/teknopunch.com.bytes bytes;
    error_log   /var/log/nginx/domains/teknopunch.com.error.log error;
		
		
location / {
		
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
			log_not_found off;
        }
		location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }
		
		
		
        location ~ [^/]\.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9001;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
        }
		location ~ /error.log 
		{ 
			deny all; 
		}

		location /admin/backups {
			deny all;
		}
		rewrite ^/forum-([0-9]+).html$ /forumdisplay.php?fid=$1 last;
		rewrite ^/forum-([0-9]+)-page-([0-9]+).html$ /forumdisplay.php?fid=$1&page=$2 last;
		rewrite ^/thread-([0-9]+).html$ /showthread.php?tid=$1 last;
		rewrite ^/thread-([0-9]+)-page-([0-9]+).html$ /showthread.php?tid=$1&page=$2 last;
		rewrite ^/thread-([0-9]+)-lastpost.html$ /showthread.php?tid=$1&action=lastpost last;
		rewrite ^/thread-([0-9]+)-nextnewest.html$ /showthread.php?tid=$1&action=nextnewest last;
		rewrite ^/thread-([0-9]+)-nextoldest.html$ /showthread.php?tid=$1&action=nextoldest last;
		rewrite ^/thread-([0-9]+)-newpost.html$ /showthread.php?tid=$1&action=newpost last;
		rewrite ^/thread-([0-9]+)-post-([0-9]+).html$ /showthread.php?tid=$1&pid=$2 last;
		rewrite ^/post-([0-9]+).html$ /showthread.php?pid=$1 last;
		rewrite ^/announcement-([0-9]+).html$ /announcements.php?aid=$1 last;
		rewrite ^/user-([0-9]+).html$ /member.php?action=profile&uid=$1 last;
		rewrite ^/calendar-([0-9]+).html$ /calendar.php?calendar=$1 last;
		rewrite ^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+).html$ /calendar.php?calendar=$1&year=$2&month=$3 last;
		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 last;
		rewrite ^/calendar-([0-9]+)-week-(n?[0-9]+).html$ /calendar.php?action=weekview&calendar=$1&week=$2 last;
		rewrite ^/event-([0-9]+).html$ /calendar.php?action=event&eid=$1 last;
    }
    error_page  403 /error/404.html;
    error_page  404 /error/404.html;
    error_page  500 502 503 504 /error/50x.html;

    location /error/ {
        alias   /home/admin/web/teknopunch.com/document_errors/;
    }

    location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;
    }

    location /vstats/ {
        alias   /home/admin/web/teknopunch.com/stats/;
        include /home/admin/web/teknopunch.com/stats/auth.conf*;
    }

    include     /etc/nginx/conf.d/phpmyadmin.inc*;
    include     /etc/nginx/conf.d/phppgadmin.inc*;
    include     /etc/nginx/conf.d/webmail.inc*;

    include     /home/admin/conf/web/nginx.teknopunch.com.conf*;
}

Forum not installed in subfolder or subdomain, installed directly in main directory (root)
Hüseyin Körbalta - kişisel blog | Twitter: @huseyinkorbalta
Reply
#29
And again you have pitfalls in your config.....

make a backup! and replace your whole config with this one! (do not replace only parts, you still have a massive pitfall problem!)
Try this config.... if you have problems with this config show us the failures and we can continue helping.

I will not continue support if you still copy parts and dont understand the whole pitfall problem, you whole nginx config is a mess and can not work.

upstream php-fpm-teknopunch {
  server 127.0.0.1:9001;
}

server {
  listen 123.123.123.123:80;
  server_name teknopunch.com www.teknopunch.com;
  return 301 https://$server_name$request_uri;
}

server {
  listen 123.123.123.123:443 ssl http2;
  server_name teknopunch.com www.teknopunch.com;

  root /home/admin/web/teknopunch.com/public_html;
  index index.php;

  access_log /var/log/nginx/domains/teknopunch.com.log combined;
  access_log /var/log/nginx/domains/teknopunch.com.bytes bytes;
  error_log /var/log/nginx/domains/teknopunch.com.error.log error;

  if ($http_user_agent ~* (HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) ) {
    return 444;
  }

  if ($http_user_agent = "") { return 444; }
  if ($http_user_agent = " ") { return 444; }
  if ($http_user_agent = "-") { return 444; }

  if ($http_user_agent ~* (Baiduspider|webalta|nikto|wkito|pikto|scan|acunetix|morfeus|webcollage|youdao) ) {
    return 444;
  }

  if ($http_user_agent ~* "PHP|curl|Wget|HTTrack|Nmap|Verifying|PingBack|Pingdom|Joomla|Wordpress") {
    return 444;
  }
 
  location / {
    #####
    # MyBB integrated seo url schema
    #####
    
    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$
    rewrite ^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ /calendar.php?calendar=$1&year=$
    rewrite ^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ /calendar.php?acti$
    rewrite ^/calendar-([0-9]+)-week-(n?[0-9]+)\.html$ /calendar.php?action=weekview&calendar=$1&we$

    rewrite ^/event-([0-9]+)\.html$ /calendar.php?action=event&eid=$1;


    #####
    # MyBB Google SEO Plugin url schema
    #####
    #rewrite ^/([^&]*)&(.*)$ https://www.emo-treff.de/$1?$2 permanent;
    #rewrite ^/((?i)sitemap-([^./]+)\.xml)$ /misc.php?google_seo_sitemap=$2;
    #rewrite ^/((?i)Forum-([^./]+))$ /forumdisplay.php?google_seo_forum=$2;
    #rewrite ^/((?i)Thread-([^./]+))$ /showthread.php?google_seo_thread=$2;
    #rewrite ^/((?i)Announcement-([^./]+))$ /announcements.php?google_seo_announcement=$2;
    #rewrite ^/((?i)User-([^./]+))$ /member.php?action=profile&google_seo_user=$2;
    #rewrite ^/((?i)Calendar-([^./]+))$ /calendar.php?google_seo_calendar=$2;
    #rewrite ^/((?i)Event-([^./]+))$ /calendar.php?action=event&google_seo_event=$2;

    try_files $uri $uri/ /index.php$uri?$args;
  }

  location ~ "^(.+\.php)($|/)" {
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_index index.php;

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param SERVER_NAME $host;

    if ($uri !~ "^/uploads/") {
      fastcgi_pass php-fpm-teknopunch;
    }
    include fastcgi_params;
  }

  location ~* \.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
    expires max;
    log_not_found off;
    access_log off;
  }

  location ~* \.(html|htm)$ {
    expires 30m;
  }

  location ~ /uploads/avatars {
    deny all;
  }

  location ~ /\.git {
    deny all;
  }

  location ~ /README.md {
    deny all;
  }

  location ~ /\.gitignore {
    deny all;
  }

  location ~* /\.(ht|git|svn) {
    deny all;
  }

  location /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
  }

  # Note: You are able to choose a different name in the Admin CP. If you've done that you need to change it here too
  location ~ /error.log {
    deny all;
  }

  # Note: You are able to rename the admin directory. If you've done that, you need to change it here too
  location /admin/backups {
    deny all;
  }

  error_page  403 /error/404.html;
  error_page  404 /error/404.html;
  error_page  500 502 503 504 /error/50x.html;

  location /error/ {
    alias   /home/admin/web/teknopunch.com/document_errors/;
  }

  location ~* "/\.(htaccess|htpasswd)$" {
    deny all;
    return 404;
  }

  location /vstats/ {
    alias   /home/admin/web/teknopunch.com/stats/;
    include /home/admin/web/teknopunch.com/stats/auth.conf*;
  }

  include     /etc/nginx/conf.d/phpmyadmin.inc*;
  include     /etc/nginx/conf.d/phppgadmin.inc*;
  include     /etc/nginx/conf.d/webmail.inc*;

  include     /home/admin/conf/web/nginx.teknopunch.com.conf*;
}
Paid support or developement: www.broatcast-consulting.de
All other: blog.broatcast.de

[Image: EbbMWfN.png]

Reply
#30
(2017-09-04, 07:55 PM)broatcast Wrote: .....
I tried the codes you gave but I get the same error again. I think mybb url structure is not working on nginx.
The MyBB developer team needs to work on this. I guess I'll reinstall the forum this time without nginx Sad
Hüseyin Körbalta - kişisel blog | Twitter: @huseyinkorbalta
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)