MyBB Community Forums

Full Version: Issue with nginx attemping to open myBB files instead of running them
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I had myBB running on an apache2 server but had to port to nginx as I needed to run a console via that and wanted it to run on port 443. I managed to install everything, but the forums do not open anymore. Instead, the server prompt you to download a file. I have limited nginx experence.

My site is https://rosharshop.com
you can see my issue when you click on the forums tab

Here is my site config file:
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/rosharshop.com/public_html;
        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html index.php;
        server_name rosharshop.com www.rosharshop.com;

    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/rosharshop.com/fullchain.pem; # manag>
    ssl_certificate_key /etc/letsencrypt/live/rosharshop.com/privkey.pem; # man>
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = rosharshop.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80 default_server;
        listen [::]:80 default_server;

        server_name rosharshop.com www.rosharshop.com;
    return 404; # managed by Certbot


}
Where is the php configuration ?
   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;
   }
(2021-01-05, 10:58 AM)Crazycat Wrote: [ -> ]Where is the php configuration ?
   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;
   }

Not enabled... I added this (which was commented out in that file)
        # Pass the php scripts to fastcgi server
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
                # With php-cgi (or other tcp sockets):
                #fastcgi_pass 127.0.0.1:9000;
        }
It didn't fix my issue. I'm running php 7.4.13, but I assume this code still works...


Now I get this error when navigating to forums: 502 Bad Gateway

Solved the 502 Bad Gateway error. I hadn't installed php-fpm.

Thanks for your help.