Support » Localhost Installs » [help] site works on LAN, but not through internet

  • showerhater

    (@showerhater)


    hi and thanks for any help.
    i tried to create my own server, on an old laptop, and host a wordpress blog on it as a way to learn linux and networking better. i have installed ubuntu 18.04, apache2, mSQL, php 7 per a tutorial on techmint.com and then tried to install WordPress. i got as far as logged in on the WP dashboard and changed some text, and the hit publish.
    Then, i tried to go to the site from my android phone not connected to the LAN, i got a cannot find server message.
    Then i googled a bit and saw that i might need to change my nameservers and possibly need to create a dns record. i changed the nameservers to wordpress’. didnt work, so i changed them back. i made a clumsy attempt to create a record on google doamins. 50/50 shot at it being right though.
    googled again and found out i may need to change the urls inside wordpress. I logged in to admin through my LAN and changed the site and email urls to mydomainname.com. saved and boom…now i cannot get into my admin page at all now. Now, no matter what i try i get a “cannot find server message”
    I did a complete uninstall and reinstall. same problems.
    So, among other things, I need help figuring out what went wrong and how to get it to work. I dont mind uninstalling and reinstalling, but because i dont know what went wrong i will just create the same situation. ive proved that yesterday, and the day before lol.
    I would also like to know which nameserver to use (wordpress or googles).
    Did i need to make a dns record on google domains to point my domain to my IP or should i delete the one i have made? if i need a record, which one and what goes where?
    i read a different tutorial that said to fix some mysql settings. I did, but it didnt do anything different.

    this is my wp-config.php file. im guessing it is correct, but i see a lot of the same kind of problems as mine on here and the first answer usually says it this file. I copy and pasted this then xxx my personal info. can anyone tell me if it is correct???
    // ** MySQL settings – You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define(‘DB_NAME’, ‘wp_xxx’);
    /** MySQL database username */
    define(‘DB_USER’, ‘xxx’);
    /** MySQL database password */
    define(‘DB_PASSWORD’, ‘xxxx’);
    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);
    /** Database Charset to use in creating database tables. */
    define(‘DB_CHARSET’, ‘utf8’);
    /** The Database Collate type. Don’t change this if in doubt. */
    define(‘DB_COLLATE’, ”);

Viewing 5 replies - 1 through 5 (of 5 total)
  • Steve

    (@golosins)

    Read this article about making web server:
    https://ruslanspivak.com/lsbaws-part1/

    It might help you to build your own server

    RossMitchell

    (@rossmitchell)

    Firstly your wp-config file settings are not that relevant to this task, what you have should be fine.

    What you are doing requires many stages, all of which need to be consistent it to work, can be like getting the holes in Swiss cheese to line up. So before you go to the trouble, may I ask if you really want to make your old laptop a public internet facing machine, many people delegate this to their commercial hosting service.

    None the less I will give you the guidance I can.
    For the sake of the discussion I will assume that your ISP has permanently assigned you an IP address of 1.2.3.4, if you instead have a dynamic IP address then you will need to add the interactions with one of the “dynamic ip DNS” providers to my instructions.
    Since you mention a LAN then I assume that you are using a modem/router as a LAN gateway, again for the purpose of explanation I will assume that the laptop has a LAN address of 192.168.1.31
    First login to the LAN modem/router and setup port forwarding for port 80 (the html default) to forward to 192.168.1.31:80, this way when the modem receives a request from the internet side it will forward it to the laptop.
    You now need to login to the domain name manager where you bought your domain name and set the domain name servers (DNS) to 1.2.3.4, after this setting has propagated through the internet’s domain caches it will tell any browser using your domain to forward the request to your modem where it will be forwarded to the laptop.
    On the laptop you need to configure the webserver (like apache2) to use the “VirtualHost” method so that when a domain request arrives at the laptop the webserver knows which file directory to load in response. Details here:
    http://httpd.apache.org/docs/current/vhosts/name-based.html

    Now you need to adjust your WordPress configuration so that the “site address” and “wordpress address” both use your domain name.

    For computers and tablets on the LAN you need to add the domain name to the “hosts” file, using a line like: “192.168.1.31 mydomainname.com”
    details on hosts file here:
    https://en.wikipedia.org/wiki/Hosts_(file)

    showerhater

    (@showerhater)

    Ross, thank you for the thorough response. I definitely want to do this. Mostly for educational purposes. I built a mining pc last year, and now im addicted to all things computer. I have no background in it, but it is a fascinating field. I’ve started taking courses with the idea of getting into the IT field.
    This may not have been a great project for a beginner to try, but with help like yours i will get it figured out.
    i will start working on it tonight.

    Stevica…that is an awesome guide. I read the first part real quick. that guy has a unique knack of explaining really technical stuff in a easy to understand way. i will go through the whole series. Thanks a lot!

    showerhater

    (@showerhater)

    ok. so i finally got through the advice you gave me and its made it worse. Now i cannot access my wp admin page. I can see the site if i am on the same network, but the site itself is messed up now too.

    any advice???

    RossMitchell

    (@rossmitchell)

    What are the site address and wordpress address ?

    Using your browser inspector, view the page HTML, what are the addresses in the <head> block of the .CSS and .JS files, also images ? The browser uses these to fetch the contents, the fact that it has just fetched the page has less than no bearing, the address must stand on its own.
    – So what address does the page load from ?
    – What addresses do you see in the head for css etc files ?
    See how these addresses navigate the network path back to the web server.

    Please do the above from both your LAN and internet connected computers.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.