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
LVL 1
Manoj ChackoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

systechadminConsultantCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Acronis Data Cloud 7.8 Enhances Cyber Protection

A closer look at five essential enhancements that benefit end-users and help MSPs take their cloud data protection business further.

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
systechadminConsultantCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft IIS Web Server

From novice to tech pro — start learning today.