Question

How to config nginx (Front end proxy for apach) for Xenforo?

I can’t connect to proxy of apache2 for nginx to config Friendly URLs fo XenForo, This is my content in sites-enabled of nginx

      server {
        listen  80;
        server_name domain.com www.domain.com;
        root /var/www/bundle;
        index index.php index.html index.htm;
        #access_log  /var/www/logs/domain.access.log;
        location / {
        try_files $uri $uri/ /index.php?$uri&$args;
        index index.php index.html;
        proxy_pass http://127.0.0.1:8080/;
        #allow 1.1.1.1 ;
    }
        location ~ /(internal_data|library) {
         internal;
       #proxy_pass http://127.0.0.1:8080;
    }
        location ~ \.php$ {
        fastcgi_pass   127.0.0.1:8080;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include fastcgi_params;
        #proxy_set_header X-Real-IP  $remote_addr;
        #proxy_set_header X-Forwarded-For $remote_addr;
        #proxy_set_header Host $host;
        #proxy_pass http://127.0.0.1:8080;
         }
 # location ~ /\.ht {
               # deny all;
       # }
}

and content in sites-available of Apache2

    <VirtualHost 127.0.0.1:8080>
    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot /var/www/bundle
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
 <Directory /var/www/bundle/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>
    </VirtualHost> 

Please help !!!.. Thank you …


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I don’t have any experience with Xenforo, so I’m not entirely sure what you mean by “friendly URLs.” If you could explain further, we might be able to help you better. Though more generally, there are some issues with the way that you have set up your reverse proxy. For instance, you don’t need to set up anything dealing with fastcgi as the proxy pass should be sending the php file to Apache to be interpreted.

Your Nginx configuration should look something like:

server {
        listen   80; 

        root /var/www/bundle; 
        index index.php index.html index.htm;

        server_name example.com; 

        location / {
            try_files $uri $uri/ /index.php;
        }

        location ~ \.php$ {
            proxy_set_header X-Real-IP  $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Host $host;
           proxy_pass http://127.0.0.1:8080;
         }

         location ~ /\.ht {
                deny all;
        }
}

The Apache configuration look pretty good. Remember to change Listen 80 to Listen 8080 in /etc/apache2/ports.conf as well.

Let us know how it goes!