Configure multiple sites on apache on windows


















You can edit your hosts file and map your local site s to whatever domain name you like. You can even map google. Windows Vista and Windows 7 have stricter security mechanism that makes changing the hosts file a lot harder. If your computer uses a decent anti-virus software, it should warn you by popping up an alert window about the modifications made in hosts file. This is because hosts file can be the target of some malware or spyware such as browser hijacker.

To achieve that, I added in two entries in Apache's httpd. Your site may be at a different directory. I normally use C drive as I ghost my system on regular basis to backup the whole computer.

Now, it's the fun part. To run a second site e. When the configuration file is opened, move to the bottom of the file - Section 3: Virtual Hosts. Note that adding AllowOverride All directive to the virtual host is important because it allows the information defined in. Save httpd. Remember this: every time you make a change to Apache configuration file, you need to restart Apache server to make the change take effect. If you can see the PHP configuration info as shown below, your setup for the second local website has worked.

If it didn't work, restart your Apache server and try again. I hope you are able to set up your second site running on the same computer using Apache Virtual Hosts.

You can add unlimited sites to your computer and one Apache serves them all. Steps to install PHP 5. How to install Apache 2. How to connect two different versions of MySQL server on the same computer 4. How to configure MySQL server 5. How to install MySQL server 5. Restart Apache2 with the command:. You've enabled a new website on your Apache2 server.

Although this is very basic information, it will allow you to run multiple hosts on a single Apache2 server. Note: It is important that you understand the ins and outs of the Apache2.

Setting up multiple hosts on Apache2 is quite different than Apache, but once you get used to the system, it makes perfect sense. Besides, if you're working with a Linux server that makes use of Apache2, you don't have a choice. He's covered a variety of topics for over twenty years and is an avid promoter of open source. For more news about Jack Wallen, visit his website jackwallen Image: Jack Wallen.

More about Networking 5 programming languages network architects should learn free PDF Behind the scenes: A day in the life of a database administrator 20 steps to decommission a redundant data center facility 17 Terminal commands every user should know.

Editor's Picks. The best programming languages to learn in Check for Log4j vulnerabilities with this simple-to-use script. When you are finished, you need to restart Apache to make these changes take effect and use systemctl status to verify the success of the restart. This will intercept any requests for the domains that you configured and point them to your VPS server, just as the DNS system would do if you were using registered domains. This will only work from your local computer though, and only for testing purposes.

Make sure you are operating on your local computer for these steps and not your VPS server. If you are on a Mac or Linux computer, edit your local file with administrative privileges by typing:. If you are on a Windows machine, you can find instructions on altering your hosts file here.

The details that you need to add are the public IP address of your server followed by the domain you want to use to reach that server. This will direct any requests for example. This is what we want if we are not actually the owners of these domains in order to test our virtual hosts.

Now that you have your virtual hosts configured, you can test your setup by going to the domains that you configured in your web browser:. This will prevent your hosts file from being filled with entries that are no longer necessary.

If you need to access this long term, consider adding a domain name for each site you need and setting it up to point to your server. If you followed along, you should now have a single server handling two separate domain names. You can expand this process by following the steps we outlined above to make additional virtual hosts. There is no software limit on the number of domain names Apache can handle, so feel free to make as many as your server is capable of handling.

Where would you like to share this to? Twitter Reddit Hacker News Facebook. Share link Tutorial share link. DigitalOcean home. Community Control Panel. Hacktoberfest Contribute to Open Source. By Lisa Tagliaferri Published on February 10, Not using Ubuntu Choose a different version or distribution. Ubuntu Introduction The Apache web server is a popular method for serving websites on the internet.

Prerequisites Before you begin this tutorial, you should create a non-root user. Step One — Create the Directory Structure The first step that we are going to take is to make a directory structure that will hold the site data that we will be serving to visitors.



0コメント

  • 1000 / 1000