[Solved] URL Forwarding error after install with VestaCP (Nginx Proxy)

  • Hello there,
    I made a clear install of NodeBB with Mongo to my VPS.
    But after successful installing I can't get access to frontpage.
    All files are located in public_html directory but there is no index.php file so I can't understand what is wrong.
    Current record in config.json is next: "url": "https://community.scienceukraine.com",
    I have SSL installed for this sub domain, but for http://community.scienceukraine.com I get "Forbidden
    You don't have permission to access / on this server."
    And for https:// I get redirected to main domain.
    I use VPS Ubuntu 16.04 + Vesta CP.
    How to fix this?

  • What is your nginx config? Did you follow a tutorial? Which tutorial?

  • Well, I followed this tutorial https://docs.nodebb.org/installing/os/ubuntu/
    All went great.

    Nginx config file

    Server globals

    user www-data;
    worker_processes auto;
    worker_rlimit_nofile 65535;
    error_log /var/log/nginx/error.log crit;
    pid /var/run/nginx.pid;

    Worker config

    events {
    worker_connections 1024;
    use epoll;
    multi_accept on;

    http {
    # Main settings
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    client_header_timeout 1m;
    client_body_timeout 1m;
    client_header_buffer_size 2k;
    client_body_buffer_size 256k;
    client_max_body_size 256m;
    large_client_header_buffers 4 8k;
    send_timeout 30;
    keepalive_timeout 60 60;
    reset_timedout_connection on;
    server_tokens off;
    server_name_in_redirect off;
    server_names_hash_max_size 512;
    server_names_hash_bucket_size 512;

  • Where are the server-specific settings? You should have it in a separate file in sites_available and link it into sites_enabled.

  • VestaCP uses nginx as reverse proxy. Apache2 - as a web server. So I don't need to configure sites_avialable and make links to sites_enabled manually. It did it automatically when I created new domain in panel.
    Apache config file? Host works just fine if I put there index.html for example. All files are chown with owner user group.

  • @valentine-solo NodeBB doesn't work that way. It's not like PHP.

  • Fortunately, I found solution for VestaCP to make NodeBB working properly.
    Hope it will be useful for others with the same problem.

    1. Create new domain in VestaCP i.e. mynewdomain.com
    2. Clone Nodebb with git to home directory of vestacp (I chose public_html dir, that's not best option for safety but I take risks) and followe instructions https://docs.nodebb.org/installing/os/ubuntu/
    3. Install Mongo DB and finish NodeBB installation. Put default Nodebb URL as "http://mynewdomain.com"
    4. Go to /home/admin/conf/web and edit nginx.conf like here https://docs.nodebb.org/configuring/proxies/nginx/
    5. Restart nginx and nodebb
    6. Go to http://mynewdomain.com and see NodeBB mighty :trollface:

    Here is my part of code from nginx.conf:

    server {
        listen      185.65.xxx.xxx:80;
        server_name network.scienceukraine.com www.network.scienceukraine.com;
        error_log  /var/log/apache2/domains/network.scienceukraine.com.error.log error;
        location @fallback {
            proxy_pass      http://185.65.xxx.xxx:8080;
    location / {
            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;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
            proxy_redirect off;
            # Socket.IO Support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        include /home/admin/conf/web/nginx.network.scienceukraine.com.conf*;

  • Like I said earlier, you should not put site-specific nginx configs in nginx.conf, but instead they should be put in sites_available and linked into sites_enabled, directories that should be in the same directory as nginx.conf

  • @valentine-solo

    The static file pieces are a helpful performance improvement and are worth leaving in.

  • @pitaj vestacp has several nginx.conf. As I mentioned I edited "site-specific" config in /home/admin/conf/web where vestacp keeps configs for all hosts, inculding ssl and lets encrypt.
    Maybe you mean global nginx.conf which is located in /etc/nginx ? I did no changes in it.

Suggested Topics

| | | |