Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

Nginx & Moodle

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
3 posts • Page 1 of 1
Author
Message
paul_chany
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 82
Joined: Sun Aug 01, 2010 4:18 pm
Location: Europe, Serbia
Contact:
Contact paul_chany
Website

Nginx & Moodle

  • Quote

Post by paul_chany » Wed Jan 13, 2016 6:11 pm

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: Select all

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
Top
gordonb3
Apprentice
Apprentice
Posts: 185
Joined: Wed Jul 01, 2015 6:24 pm

  • Quote

Post by gordonb3 » Wed Jan 13, 2016 8:05 pm

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

Example:

Code: Select all

try_files $uri $uri/index.html
Top
paul_chany
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 82
Joined: Sun Aug 01, 2010 4:18 pm
Location: Europe, Serbia
Contact:
Contact paul_chany
Website

  • Quote

Post by paul_chany » Fri Jan 15, 2016 10:17 am

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
Top
Post Reply

3 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic