Ok, let’s go for the long explanation.
I installed tutor on aliyun cloud host, because I don’t have a domain name, I think I need a reverse proxy to proxypass the requests to lms and cms.
No you don’t! A reverse proxy does not have anything to do with the fact that you do not own a domain name. A reverse proxy is only required when you need to setup multiple web services on the same server, as explained in the docs.
But I don’t know what’s wrong, the nginx is always serving default nginx welcome page to me when I request with my IP address. Even if I changed my port from 80 to 8080. Everything works fine when I use curl on the host with terminal. But when I access http://IPADDRESS:8080 from my local computer browser, it just shows default nginx welcome page.
This is because of the following directive in the web proxy:
server_name www.myopenedx.com preview.www.myopenedx.com studio.www.myopenedx.com;
This means that only web requests for these server names will be redirected to the LMS/CMS. Other requests will be served by the default nginx server, which will simply print the nginx welcome message.
and when I changed the location from ‘/lms/’ to root location, it showed a bad request with error code 400.
There are two things to understand here. First, despite the server_name
directive, the nginx conf file is the default server for all requests incoming on port 8080. So, when you setup location /
, all requests are forwarded to the LMS. But, and this is the second thing to understand, the LMS django application is configured to accept only requests that were sent to the right host: either www.myopenedx.com or localhost: tutor/tutor/templates/apps/openedx/settings/lms/production.py at master · overhangio/tutor · GitHub
When the LMS receives a request that does not match one of these hosts, it responds with a 400 error.
I suggest you get rid of the web proxy: uninstall nginx and reset tutor setting:
tutor config save --set WEB_PROXY=false
Then, run tutor local quickstart
again. During configuration, set your server IP address as the LMS host. DO NOT enable https. You should be able to access your platform on port 80: http://<your server ip>
As an alternative, if your personal computer is running on Linux, you can configure myopenedx.com
and studio.myopenedx.com
as your LMS/CMS hosts. Then configure your computer to point these domain names to your server: to do so, add the following content to the /etc/hosts
file on your personal computer:
<your server IP> myopenedx.com studio.myopenedx.com