• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 50
  • Last Modified:

Running WordPress site on IIS 10 from localhost using actual host-name simultaneously with the real site.

Running WordPress site on IIS 10 from localhost using actual host-name simultaneously with the real site.

I have a site running on Apache ("site.com", ip: IP1) connecting to database ( DB1)

I am planing to move the site from apache to IIS10, I already moved the files.
Can I have a URL ("site.com", looking at localhost not going through internet) connecting to the same database ( DB1)

So that I can make sure its working before connecting the real IP. Not sure if this makes sense.

Thanks
Manoj
0
Manoj Chacko
Asked:
Manoj Chacko
  • 3
  • 3
  • 2
1 Solution
 
Gaurav SinghSolution ArchitectCommented:
you will need to put website header in IIS. Under Binding -- edit bindings put site.com under host header value.

Also make sure that your DNS record should point to IIS server .  external dns and internal dns as well.
0
 
gr8gonzoConsultantCommented:
It depends on your configuration, namely your reliance on .htaccess. For example, if you use the .htaccess file to configure rewrite rules to enable short URLs like http://www.site.com/postnamehere, then you'll have to configure IIS separately to support that rewrite, since .htaccess files are specific to Apache.

Gaurav already mentioned the bindings, but you should NOT point the DNS record to the IIS server. That will change the server that the public goes to, which you indicated was not what you wanted just yet (that you wanted to test it out on IIS first).

If you want to do a machine-specific override of DNS, add an entry into your hosts file (C:\Windows\System32\drivers\etc\hosts). You'll likely need to update the permissions on that file to allow you to edit it, but once you've done that, it's real simple. Let's say your IIS server is local (127.0.0.1) and your site is at www.ManojChacko.com - just add a line like this to your hosts file:

127.0.0.1 www.manojchacko.com

Once you do that, restart any open Internet Explorer instances and from that point on, any time you try to go to www.manojchacko.com, it will skip the DNS lookup and just use the value from your hosts file instead. Again, this will ONLY affect the machine where you've made the change to the hosts file. Everybody else will keep going to the old Apache server as if nothing has changed.

Next, you'll need to configure your database user account to allow remote connections from your IIS server and ensure that any firewalls are properly configure to allowed traffic between the IIS server and the MySQL server (typically TCP traffic on port 3306). You'll likely have to issue another GRANT query (check your MySQL documentation for the syntax or use a tool like HeidiSQL to manage the accounts).

Finally, bear in mind that because of the remote DB connection, it IS going to run slower than if your database was local. WP is pretty DB-intensive, so that overhead of the remote connection will be multiplied across every query.

All that said, is there a particular reason you're going to IIS? Wordpress excels at running on Apache and there's more than a few plugins that rely on the ability to configure .htaccess easily. You can definitely port just about any configuration over to IIS, but since Apache and PHP and MySQL all run pretty well on Windows, it seems a little odd to use IIS if you've already got it working on a LAMP stack.
0
 
gr8gonzoConsultantCommented:
Alternatively, you can also use the hosts trick to set up a fake subdomain, like "dev.manojchacko.com" that only your PC sees, and then set up a copy of the database on your local server (just download and install a local MySQL service), and then just update the wp_options table on your local copy (there are 2 options that refer to the full domain name - just update those to use the "dev" subdomain).

That way, any mistakes or unintended errors from the local test instance of WP won't have a chance of breaking / impacting the production DB at all (just in case).
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Manoj ChackoAuthor Commented:
I set up my host file 127.0.0.1 www.manojchacko.com

and added the website through IIS Manager and did the binding but when I navigate to the url it still takes me to the default IIS page.
0
 
gr8gonzoConsultantCommented:
Make sure you stop the default site and ensure your new site is started.
0
 
Manoj ChackoAuthor Commented:
So it works when I use random URLs, but when I use my real existing url it goes to the IIS Welcome page
0
 
Gaurav SinghSolution ArchitectCommented:
make sure you set the correct default documents in IIS for your website
0
 
Manoj ChackoAuthor Commented:
I did, weird thing is if I change the name in the host file and the binding to something fake random names it works
but when I use the actual name that I want (already exists) it does not load. goes to IIS main page
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now