0

I have a subdomain (lms.rguktn.ac.in) on godaddy's servers shared hosting. I wwant the subdomain to point to the server 117.254.89.189/moodle

I have configured it but the subdomain is redirecting to IP address. what I want is the site to be accessed as lms.rguktn.ac.in

#
# The default server
#

server {
listen       80 default_server;
#listen       [::]:80 default_server;
server_name  _;
root         /var/www/html;

# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;

location / {
        index index.html index.php index.htm;
}

error_page 404 /404.html;
    location = /40x.html {
}

error_page 500 502 503 504 /50x.html;
    location = /50x.html {
}

location /phpmyadmin {
    alias /usr/share/phpMyAdmin/;
    client_max_body_size 200M;
}
}

server {
listen 80;
listen [::]:80;

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

server_name lms.rguktn.ac.in;

location / {
    try_files $uri $uri/ /index.php?q=$uri&$args;        
}

location ~ \.php$ {
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass 127.0.0.1:9000;
    try_files $uri @uri/ =404;

}
}
  • 1
    You can't use DNS to resolve a URL. You'll need to to this in your code. – joeqwerty Apr 18 '18 at 11:20
0

Let's clarify this:

  • You have rguktn.ac.in set up for 166.62.10.188

  • You have lms.rguktn.ac.in set up for 117.254.89.189

What you want is basically lms.rguktn.ac.in/moodle to be available, right? Or with IP address? Either way, you have to set your nginx.

I would just delete your NginX (since I can see from your nginx.conf that it isn't from the official repo), and reinstall it after I've added NginX repository. Then add a new config file for your websites/each and there you go.

| improve this answer | |
  • Yes. But I want lms.rguktn.ac.in to load 117.254.89.189/moodle. As for nginX, It's not nginx.conf. I am editing default.conf. – Vamshi Apr 18 '18 at 11:27
  • Never edit the default.conf. Always create new config files for different domains. In this case, your job is easy. Go to the server that serves the lms.rguktn.ac.in (since this is your 117.254.89.189 server) and just create a new config where you add for server_name the IP address and then create a /moodle location in the config. It is this simple. ;) – Bert Apr 18 '18 at 14:18
0

On the moodle backoffice check what you have for your website name (url address) and the same in the config file for the moodle. The URL you have them is used in all rest of content which you created when you have setup it. You must change this URL too in moodle database. In the moodle on the backend is the option to change URL in moodle content (database) but it is not officially supported.

| improve this answer | |
  • Yeah.. that is true. I forgot that. let me try and come back to you. – Vamshi Apr 18 '18 at 11:36
  • That's right. Now the style sheet and js files are not loading. Failed to load resource: the server responded with a status of 404 (Not Found) – Vamshi Apr 18 '18 at 12:06
  • 1. Backup moodle database and make a copy of this file; 2. Use sed to replace old URL to new URL on exported database file (copy from 1st point); 3. Import this "new" database – mariaczi Apr 18 '18 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.