Azure VM does not serve external website - php

I spun up a Windows 2012 R2 Datacenter VM.
Endpoints have ports 21,80,443 successfully added to the dashboard.
Installed Wordpress/PHP on the VM using the Web Platform Installer.
Wordpress site works fine using localhost.
Trying to hit the DNS (mysite.cloudapp.net) or the public IP, shows just the generated version of the site below. Clicking links results in an "unable to connect" error.
Anyone know what I might be doing wrong?

By default, when you finish installing wordpress, the address URL is set to
http:/localhost/wordpress
When you browse your site with DNS, the resources file urls are still referring to like http://localhost/......
So, we need to sign in wordpress admin portal in your VM, click “setting”=>”general”, set “WordPress Address (URL)” and “Site Address (URL)” to http://<your_vm_name>.cloudapp.net/wordpress, and save changes.
If you have any further concern, please feel free to let me know.

wordpress is normally url based, make sure it's configured for wildcard or the cloudapp.net domain.

So one thing you can do is see if you can log into /WP-admin and check the home and url links under Settings>General to see if they match site.cloudapp.net. If they do you might also want to check under your wordpress's theme files in functions.php and add the following lines to the top after <?php
update_option('siteurl','http://example.com');
update_option('home','http://example.com');

Related

NGROK changes url from CUSTOM_URL to localhost

I'm trying to make my wordpress website available for others to see using WampServer and ngrok. But when I expose local server to the Internet with 'ngrok http 80' all that people can access is the WampServer admin panel. When they click my wordpress project they get redirected to localhost/wprdpres directory instead of the custom link provided by ngrok.
I can also say that it worked perfectly before I installed a new theme. Is there a way this could have any influance on that?
Some screenshots:

WordPress site isn't working after I migrated site - changed site address (URL)

I migrated from my local computer to my live server using Duplicator. When I switched over, my Wordpress Address (URL) was http://107.343.442.344 - my IP address - and the Site Address (URL) was http://nameofwebsite.com. Everything appears to be working just fine.
However, when I add an item to my cart and try to delete it, it doesn't remove the item. I check the console and there's a failed AJAX request. It's requesting information from http://107.343.442.344. So, I change the Site URL to http://107.343.442.344 and then the everything works just fine. However, now I can't go to my front page.
I tried making these changes to the database (WP-Options), but nothing works.
Does anyone know what I can do to correct the problem. I've contacted WooCommerce, but they're taking forever.
My site is not currently up, so you can't go to it.
Easiest way how to properly migrate your site from localhost to server:
Copy all your local site files to web server
Install and activate "WP Migrate DB" plugin to your local site, it's free and got all functionality you will need.
After "WP Migrate DB" activation you will find it under "Tools" > "Migrate DB". Open "Migrate DB", there will be empty "Replace" block with two fields which you need to fill (look at the picture below).
These two fields are only one you need to fill, after that click on "Export" button and plugin will download mysql database.
Login into your hosting cPanel (or any other webhosting management app if your hosting doesn't provide cPanel, for example, ISPconfig etc.) and create new database or replace old one with that which you just created with "WP Migrate DB" plugin.
Open and edit wp-config.php file on your public_html folder on webserver, replacing database name and other authentification credentials (change database name, database user and password which you created in cPanel) and save this file.
Done, enjoy. :)
i think you database is not migrate properly please try again with wp migrate db plugin or search replace file , if problem still appear then check the serve file and folder permissions
So I found out what the problem was. I was using VHS Host to redirect the IP address to my new server. Once I changed the nameservers to point towards my new server, it worked.
Thanks to everyone who posted a response. I really do appreciate it.

access wordpress site from another machine

I'am new to the WordPress and I created WordPress website and configure it within the Wamp Server. The site displays all it's contains locally correctly. Now I want to access that website from the another machine within same network but it did not display all the contents correctly. it displays only the text. no images and the applied theme is not displays. I turn off the firewall and change the Apache configuration file (httpd.config) as follows. but it also didn't work properly. please help me.
Order allow, deny
Allow from all
The problem is that you specify during install that the hostname of the site is "localhost". Unofrtunately when you connect from another computer the link to "localhost" refers to the pc you are connecting from and since in this pc there isn't any server runnin,g you see only the text and not the images or the css.
The solution is to modify the wp-config.php wordpress file and change this from:
define('DB_HOST', 'localhost');
to:
define('DB_HOST', '192.168.0.4');
The problem is with URL of the site. You need to update the URL in database and replace localhost with IP of your machine using phpmyadmin and then that site will be accessible from other machines in your network. Please try this and it will solve your problem.
This is a WordPress oddity. When you install WP on localhost, or anywhere, it stores the url used in the install in its database. It then uses this url internally in its code to build links etc.
So when you come to run this site from another PC, things like image links will be built with the url localhost or localhost/wordpress.
Now when you run this from another PC using a different URL like 192.168.0.4/wordpress localhost will still appear in the links and of course there is no localhost on the client PC. So the links dont work. Its a bit like you have moved your site to a new url, but WP does not know about it.
Read this post on the WP Codex to work out what you need to so to amend the urls in the database. OF course this means you wont be able to use localhost anymore on the WAMPServer machine either.

Wordpress website renders differently on devices apart from the local server

I am using my laptop as a test environment for a wordpress website before I move it to an online server. I have this setup with a xampp sever running on the local machine. Wordpress is installed and running a theme which I have modified somewhat. When I navigate to the website from the local machine by going to 'localhost', the website displays correctly, however if I navigate to the website from another device whether it may be a computer, phone or tablet, the website seems to exclude css styling and only displays plain html. Any insights would be appreciated.
I know that with some browsers, sites in your local intranet except localhost are rendered differently. I am not sure whether this is the issue here. I am using Chrome Version 42.0.2311.135 dev-m
When you're accessing the site on another machine, open up the developer tools in your browser and see where the link to your CSS is pointing at.
It sounds like that CSS URL is hard-coded to be pointing at localhost (which would explain why it only works on your machine). It could also be the case that you have set your site's domain to be localhost in Wordpress which may be using that to render the URLs.
Double check your Wordpress settings, and also your theme's code.

No CSS/formatting on wordpress blog from external computers

I'm trying to set up a wordpress blog hosted from my computer using this tutorial. When I visit the site on the computer it's hosted on, via localhost or the IP of the computer, the site looks fine, but when I visit it from another computer it looks like this.
All Wordpress resources (stylesheets and images at least) use Wordpress' URL configuration. You can find it as the 3rd option down in the General Configuration page of your Admin. This is due to the way that themes are to be programmed and create the header of the blog using the bloginfo function that uses those configuration values to generate the rest of them
What is probably happening is that such URL is using either localhost or 127.0.0.1. If that is the case, when accessing the blog from your own PC it would show fine as both do resolve to the local machine. If you access it from an external PC, they would not resolve to the PC that is serving Wordpress but also to the local PC - which is not able to provide them.

Categories