NGinx Xenforo

jbex

Member
Xenforo Forum v2.1.11
VPS server with Nginx and Maria DB
Cache the file system following the instructions in the Manual and adding the lines:
$ config ['cache'] ['enabled'] = true;
$ config ['cache'] ['provider'] = 'Filesystem';
$ config ['cache'] ['config'] = ['directory' => '/ path / to / your / cache / directory'];


Every time the forum is updated, it counts one more user, you update 10 times there are 10 users, you update 40, then 40 users online.
Contact us does not send the message, although the sending works fine in the proof of sending from the email verification tool.
Everything else is going very well, you log in and out, upload attachments, images, reply, delete topics, etc, etc.

Let's see if someone can help me, I'm sure it's a cache thing but I don't know anything about server administration.
The company that hosts me does not give me a solution to the issue, so I continue on my previous server until everything works fine on this one.
I hope it is understood, I use an automatic translator.
a greeting
 

RisteD

Member
For problem related to sending emails from VPS server there are some tips to resolve this issue:

1) Check firewall for opened ports there should be opened port 25 for SMTP protocol
2) If the port 25 is closed, log in XenForo admin control panel and change
Email transport method to something you prefer. That page is located in Options, Email Options.
Fill the details and save it. Then make test emails and check if this will resolve your issue.
 

jbex

Member
Good morning, that is the least of the problems, since I only get spam from contacting us.
But if there are registration emails, at least the administration tool indicates everything is correct in the delivery and the test emails arrive in my mailbox.
Looking at firewall rules I see that port 25 TCP Allow is open

The point is that every time you update it counts one more user, if you update 40 times it tells you there are 40 users, when this site is only visible editing hosts to point the domain to this new one.

thanks for your help
 

Overscan

Active member
Presumably

config ['cache'] ['config'] = ['directory' => '/ path / to / your / cache / directory'];

you actually put a path to a real folder that exists on the server?
 

jbex

Member
Yes, if there is a folder path and you have write permissions, everything goes well with 1 vCores, 2 GB of RAM and 30 GB of Flash disk, it is only the problem of accumulated users, the mail goes well.
It does not work for me, contact us and when updating it adds new users.
Truncate tables, repair and optimize tables, etc.
I tell you everything works ok except those two details, it was working for two days and that's when we realized the problem and we turned the dns back to the old man.
Greetings and thank you
 

jbex

Member
Uncache the config.php file and the problem persisted.
See if anyone sees something wrong.
nginx.conf
Code:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    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;

    ##
    # SSL Settings
    ##

    # ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    # ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

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

    ##
    # Gzip Settings
    ##

    # gzip on;

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/hosting/general.conf;
    include /etc/nginx/sites-enabled/*;
    include /etc/nginx/hosting/vhosts/*.conf;
}


#mail {
#    # See sample authentication script at:
#    # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#    # auth_http localhost/auth.php;
#    # pop3_capabilities "TOP" "USER";
#    # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#    server {
#        listen     localhost:110;
#        protocol   pop3;
#        proxy      on;
#    }
#
#    server {
#        listen     localhost:143;
#        protocol   imap;
#        proxy      on;
#    }
#}

Default sites-avalable:

Code:
 You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }

    # pass PHP scripts to FastCGI server
    #
    #location ~ \.php$ {
    #    include snippets/fastcgi-php.conf;
    #
    #    # With php-fpm (or other unix sockets):
    #    fastcgi_pass unix:/run/php/php7.3-fpm.sock;
    #    # With php-cgi (or other tcp sockets):
    #    fastcgi_pass 127.0.0.1:9000;
    #}

    include /etc/nginx/hosting/sw-php7.4.conf;

    include /etc/nginx/hosting/all_vhosts.conf;

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny all;
    #}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#    listen 80;
#    listen [::]:80;
#
#    server_name example.com;
#
#    root /var/www/example.com;
#    index index.php index.html;
#
#    location / {
#        try_files $uri $uri/ =404;
#    }
#}
nginx /hosting/vhosts/dominio.com.conf
Code:
# nginx virtual host for domain 'dominio.com'

# Rate limit for each domain
limit_req_zone $binary_remote_addr zone=dominio.com_rate:1m rate=150r/s;

# Cache limit for each domain
proxy_cache_path /var/www/dominio.com/cache levels=1:2 keys_zone=dominio.com_proxy:5m max_size=67108864;

server {
        listen 80;
        root "/var/www/dominio.com/datos/web";
        index index.html index.php;
        server_name dominio.com www.dominio.com;
        access_log /var/www/dominio.com/logs/nginx_access_20200918.log;
        error_log /var/www/dominio.com/logs/nginx_error_20200918.log;
        include /etc/nginx/swhosting/all_vhosts.conf;
        # Uncomment the following two lines to redirect all web traffic to HTTPS for this domain
        # enforce https
        # return 301 https://$server_name$request_uri;

        limit_req zone=dominio.com_rate burst=50 nodelay;
       
        add_header X-Proxy-Cache $upstream_cache_status;
        set $no_cache "";
        set $cache_cookie $http_cookie;
        if ($cache_cookie !~ "^\s*$") {
                set $no_cache 1;
        }

        location / {
                proxy_pass http://127.0.0.1:8080;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                access_log off;
                proxy_cache_key "$scheme$request_method$host$request_uri";
                proxy_no_cache $no_cache $http_pragma $http_authorization $arg_nocache;
                proxy_cache_bypass $no_cache $http_pragma $http_authorization $arg_nocache;
                proxy_cache dominio.com_proxy;
                proxy_cache_valid "5";
                proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504 updating;
        }

        location @fallback {
                proxy_pass http://127.0.0.1:8080;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                access_log off;
                proxy_cache_key "$scheme$request_method$host$request_uri";
                proxy_no_cache $no_cache $http_pragma $http_authorization $arg_nocache;
                proxy_cache_bypass $no_cache $http_pragma $http_authorization $arg_nocache;
                proxy_cache dominio.com_proxy;
                proxy_cache_valid "5";
                proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504 updating;
        }

        location ~ ^/(.*\.(ac3|avi|bmp|bz2|css|cue|dat|doc|docx|dts|eot|exe|flv|gif|gz|htm|html|ico|img|iso|jpeg|jpg|js|mkv|mp3|mp4|mpeg|mpg|ogg|pdf|png|ppt|pptx|qt|rar|rm|svg|swf|tar|tgz|ttf|txt|wav|woff|woff2|xls|xlsx|zip))$ {
                etag on;
                if_modified_since exact;
                add_header Pragma "public";
                add_header Cache-Control "max-age=30d, public";
                try_files $uri @fallback;
        }

}
server {
    listen 443 ssl http2;
    ssl on;
    ssl_certificate /etc/ssl/hosting/certs/dominio.com.pem;
    ssl_certificate_key /etc/ssl/hosting/private/dominio.com.key;
        root "/var/www/dominio.com/datos/web";
        index index.html index.php;
        server_name dominio.com www.dominio.com;
        access_log /var/www/dominio.com/logs/nginx_access_20200918.log;
        error_log /var/www/dominio.com/logs/nginx_error_20200918.log;
        include /etc/nginx/hosting/all_vhosts.conf;

        limit_req zone=dominio.com_rate burst=50 nodelay;
       
        add_header X-Proxy-Cache $upstream_cache_status;
        set $no_cache "";
        set $cache_cookie $http_cookie;
        if ($cache_cookie !~ "^\s*$") {
                set $no_cache 1;
        }

        location / {
                proxy_pass https://127.0.0.1:8081;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                access_log off;
                proxy_cache_key "$scheme$request_method$host$request_uri";
                proxy_no_cache $no_cache $http_pragma $http_authorization $arg_nocache;
                proxy_cache_bypass $no_cache $http_pragma $http_authorization $arg_nocache;
                proxy_cache dominio.com_proxy;
                proxy_cache_valid "5";
                proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504 updating;
        }

        location @fallback {
                proxy_pass https://127.0.0.1:8081;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                access_log off;
                proxy_cache_key "$scheme$request_method$host$request_uri";
                proxy_no_cache $no_cache $http_pragma $http_authorization $arg_nocache;
                proxy_cache_bypass $no_cache $http_pragma $http_authorization $arg_nocache;
                proxy_cache dominio.com_proxy;
                proxy_cache_valid "5";
                proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504 updating;
        }

        location ~ ^/(.*\.(ac3|avi|bmp|bz2|css|cue|dat|doc|docx|dts|eot|exe|flv|gif|gz|htm|html|ico|img|iso|jpeg|jpg|js|mkv|mp3|mp4|mpeg|mpg|ogg|pdf|png|ppt|pptx|qt|rar|rm|svg|swf|tar|tgz|ttf|txt|wav|woff|woff2|xls|xlsx|zip))$ {
                etag on;
                if_modified_since exact;
                add_header Pragma "public";
                add_header Cache-Control "max-age=30d, public";
                try_files $uri @fallback;
        }

}
 

Overscan

Active member
You could log a support ticket?

Don't understand your nginx config at all. What's the point of the reverse proxy stuff? Whats listening on port 8080/8081?
 

jbex

Member
The support is the one who has configured the entire server and backed up the information of the old one.
When I have told you about the problem, you have not been able to solve the issue.
That is why I have opened this thread, to see if someone can tell me what the problem may be
 

jbex

Member
Steps taken
config ['cache'] ['enabled'] = false
/etc/init.d/nginx restart ;
Renamed cache folder
Problem persists. More information:
Private messaging (Conversations) does not work. It works but shows only a part of it, the same shows you 6 MP in a conversation of 19.

WorPress
A plugin has prevented updates by disabling wp_version_check().

The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.

The REST API call gave the following unexpected result: (403) {"code":"rest_cookie_invalid_nonce","message":"La cookie nonce no es v\u00e1lida","data":{"status":403}}.

The scheduled event, qs_cron_hook, failed to run. Your site still works, but this may indicate that scheduling posts or automated updates may not work as intended.

a greeting
 

Mouth

Well-known member
Could you or can you give me the steps for it?
Sorry, no. You really need to understand what changes you are making and why, it could present you other problems if not.
If you did not setup nginx, then I suggest you ask whomever did setup/configure it for you to assist with modifying it.
Otherwise, there's several offers for paid assistance with server configuration within https://xenforo.com/community/forums/third-party-services-offers.42/ - @MattW is a name that comes up regularly with lots of good recommendations.
 

duderuud

Well-known member
Maybe it's better to get some hosting done for you. It can be very dangerous to (eventually) run a website when you don't fully understand how to setup a webserver yourself.
 

Overscan

Active member
If you don't understand the basics of nginx, php etc, then you need a managed hosting provider who understands what they are doing for you. The onus should be on them to resolve it.
 

jbex

Member
Thank you, I only paid a month and I have abandoned this hosting, since not only could they not solve the problem, but it was getting worse and worse.
Currently I have mounted another VPS 2 vCores at 3.4 Ghz AND 2 GB RAM
70 GB SSD with CyberPanel and I have mounted the web (WP) and installed Xenforo and everything is going great.
It remains for me to change the DNS and see how it behaves in production.
thanks for your help
 
Top