Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Nginx & Moodle
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
paul_chany
Tux's lil' helper
Tux's lil' helper


Joined: 01 Aug 2010
Posts: 82
Location: Europe, Serbia

PostPosted: Wed Jan 13, 2016 6:11 pm    Post subject: Nginx & Moodle Reply with quote

Hi,

I'm trying to setup Moodle with Nginx.

All packages: nginx, moodle have installed with emerge.

I have installed nginx/1.9.7.

I first installed moodle, after that installed moodle with webapp-config.
Now when try to open my Moodle at http://localhost/moodle I get error message:
403 Forbidden

I'm following https://docs.moodle.org/29/en/Nginx .

/etc/nginx/nginx.conf
Code:
server {
                listen 80;
                server_name cspl.hu www.cspl.hu;

                access_log /var/log/nginx/localhost.access_log main;
                error_log /var/log/nginx/localhost.error_log info;

                root /var/www/localhost/htdocs;

                location ~ [^/]\.php(/|$) {
                    # Test for non-existent scripts or throw a 404 error
                    # Without this line, nginx will blindly send any request ending in .php to php-fpm
                    try_files $uri =404;
                    fastcgi_split_path_info  ^(.+\.php)(/.+)$;
                    fastcgi_index       index.php;
                    fastcgi_pass        unix:/run/php-fpm.socket;
                    include             fastcgi_params;
                    include             /etc/nginx/fastcgi.conf;
                    fastcgi_param       PATH_INFO       $fastcgi_path_info;
                    fastcgi_param       SCRIPT_FILENAME $document_root$fastcgi_script_name;
                }
                location /dataroot/ {
                    internal;
                    alias /var/www/localhost/moodle/; # ensure the path ends with /
                }
        }


What should I do to solve this problem?
_________________
Best, Pali
Back to top
View user's profile Send private message
gordonb3
Apprentice
Apprentice


Joined: 01 Jul 2015
Posts: 185

PostPosted: Wed Jan 13, 2016 8:05 pm    Post subject: Reply with quote

You're missing a global try_files directive that tells nginx to load some default file if the uri is a directory.

Example:
Code:
try_files $uri $uri/index.html
Back to top
View user's profile Send private message
paul_chany
Tux's lil' helper
Tux's lil' helper


Joined: 01 Aug 2010
Posts: 82
Location: Europe, Serbia

PostPosted: Fri Jan 15, 2016 10:17 am    Post subject: Reply with quote

Finally I set Nginx, Php-fpm and Moodle.

It works now.

Only the Bubba 2 headless server is to slow to handle http and php requests when I want to set my Moodle site up.
_________________
Best, Pali
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum