Support » Localhost Installs » can’t resolve domain name on local server

  • Resolved moebiaes

    (@moebiaes)


    Hello,

    So I’ve been trying to install wordpress on a pi at home. The server works just fine! the LAMP setup is pretty straightforward and clean. I can access the default Apache page, than my site through the machine’s IP address or localhost. But things get sour when I try to configure the site to answer to my domain name.

    I think I tried every trick in the book?
    – configuring a virtualhost in Apache site’s .conf (ServerName & ServerAlias)
    – changing hostnames in /etc/hosts from 127.0.0.1 [name_of_the_machine] to 127.0.0.1 [name of the site
    – configure a redirection directly in the .htaccess file (works fine! …but is overwritten by wp-config.php so I suspect the solution might be here?)
    – change URLs in the dashboard – when I do this I can no longer access anything
    – change database registry with WP CLI (same result)
    – hardcode the URLs in the wp-config.php file (same result)

    The DNS is correctly configured on the registrar side, when I setup port forwarding it links perfectly to my public IP and my public IP displays perfectly… my local machine’s IP, so the problem really is local.

    I tried reinstalling and reconfiguring all that stuff around 15 times now and I’m confused and tired.

    Does anyone have any idea of what I’m doing wrong and any solution to propose – other than “go to a host provider” or “hire a web developer”?

    Thanks a lot for your answers!

    • This topic was modified 4 weeks, 1 day ago by James Huff. Reason: moved to Localhost Installs since this is a localhost install
Viewing 4 replies - 1 through 4 (of 4 total)
  • So I’ve been trying to install wordpress on a pi at home. The server works just fine! the LAMP setup is pretty straightforward and clean. I can access the default Apache page, than my site through the machine’s IP address or localhost. But things get sour when I try to configure the site to answer to my domain name.

    Let’s get WordPress out of the picture for the time being.

    Can you access a STATIC HTML or PHP URL (not a WordPress page!) placed inside the root of the same directory where WordPress is installed… using the domain name?

    If YES, then we can look at WordPress.

    If NO, then you need to sort that out first before dealing with WordPress.

    Thread Starter moebiaes

    (@moebiaes)

    Thank you for your reply! I solved the problem in the mean time : for those who’d stumble upon the same block, the default settings of Apache didn’t allow Override in the folders I’ve installed my WP to. This is now fixed and the website is up and working!

    • This reply was modified 4 weeks ago by moebiaes.

    Hi moebiaes
    please maybe you can explain the way you solved your problem, its can help to others in the same case.
    thanks

    Thread Starter moebiaes

    (@moebiaes)

    Okay, I’m going to try to be more thorough.

    In /etc/apache2 there’s a file called ‘apache2.conf’. You have to edit it so that, around line 160-170, where your directories are, the path in which you installed wordpress shall display “AllowOverride all” instead of “AllowOverride none”. It will allow Apache to rewrite the indexes in the .htaccess file and permit the redirection. So if it’s off by default there’s no use in changing the URLs, Apache just won’t redirect correctly.

    Search for these lines :

    <Directory />
            Options FollowSymLinks
            AllowOverride None
            Require all denied
    </Directory>
    
    <Directory /usr/share>
            AllowOverride None
            Require all granted
    </Directory>
    
    <Directory /var/www/>
            Options Indexes FollowSymLinks
            <strong>AllowOverride all</strong>
            Require all granted
    </Directory>
    
    #<Directory /srv/>
    #       Options Indexes FollowSymLinks
    #       AllowOverride None
    #       Require all granted
    #</Directory>

    and switch the “allow override” section of your installation folder accordingly from “None” to “All”.

    Note that in my default config file for Apache2, the /srv/ directory is disabled by default (see the sharp signs) so if you made your wordpress install there, you’ll have to activate this section and enable “AllowOverride” in it. Simply remove the sharp signs!

    I hope I’ve been understandable, I’m no native english speaker! Good luck with that!

    Now my problem is that my entire site is online except the home page, that seems to still be redirected to my local IP but I don’t exactly know where.

    • This reply was modified 3 weeks, 2 days ago by moebiaes.
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.