Tutorial: Hosting PHP/MySQL Websites on a OuiHeberg Windows VPS
Hosting a PHP/MySQL website on a Windows VPS is an excellent solution for projects requiring reliable performance and advanced customization. Here's how to set up a web server on your OuiHeberg VPS using WAMP (Windows, Apache, MySQL, PHP).
Prerequisites
- A Windows VPS (provided by OuiHeberg).
- A Remote Desktop Connection (RDP) to access the VPS.
- A stable internet connection.
Step 1: Connecting to Your Windows VPS
- Retrieve your RDP details from your OuiHeberg client area.
- IP address, username, password.
- On your local computer, launch the Remote Desktop application:
- Enter the IP address of your VPS.
- Log in using your credentials.
- Once connected, you’ll have access to the VPS desktop.
Step 2: Download and Install WAMP
- Download WAMP:
- Install WAMP:
- Follow the steps in the installation wizard.
You may encounter an error like this:
--------------------------- Installation --------------------------- VC_2010_SP1_REDIST_X86 - Visual C++ 2010 SP1 Redistributable Package (x86) **** NOT INSTALLED **** ... (additional messages omitted for brevity).
Steps to resolve the issue:
-
Download the missing packages: Visit the link provided:
https://wampserver.aviatechno.net/
Go to the "Visual C++ Redistributable Packages" section and download the following versions:
- VC++ 2010 SP1 (x86 and x64)
- VC++ 2012 Update 4 (x86 and x64)
- VC++ 2013 Update 5 (x86 and x64)
- VC++ 2015-2022 (x86 and x64)
-
Install the packages: Once downloaded, install all the required versions by double-clicking each file.
-
Verify the installation: After installing the packages, restart the software installation. The issue should be resolved.
-
- Choose a default installation folder (e.g.,
C:\wamp64
).
- When prompted for a browser, select one of your choice (e.g., Chrome).
Step 3: Basic WAMP Configuration
- Start WAMP:
- Launch the WAMP application.
- Ensure the WAMP icon in the taskbar is green (indicating Apache and MySQL are running properly).
- Verify the Apache server:
- Open a web browser on the VPS.
- Go to
http://localhost/
to view the WAMP homepage.
Step 4: Create a MySQL Database
- Click the WAMP icon in the taskbar and select phpMyAdmin.
- Log in using the default credentials:
- Username:
root
- Password: (leave blank by default).
- Create a new database:
- Click New Database.
- Enter a name for the database, e.g.,
my_site_db
.
Step 5: Host Your PHP Site
- Add your PHP files:
- Place your site files in the
C:\wamp64\www\
directory (e.g., C:\wamp64\www\my_site
).
- Configure a virtual host (optional):
- Click the WAMP icon > Tools > Add a Virtual Host.
- Enter a name for your site (e.g.,
my_site.local
) and the path to your site folder.
- Add an entry to the
hosts
file to map your virtual host to localhost
.
- File:
C:\Windows\System32\drivers\etc\hosts
- Line to add:
127.0.0.1 my_site.local
Step 6: Test Your Site
- Open a browser and access your site:
http://localhost/my_site
or http://my_site.local
(if a virtual host is configured).
- Ensure your site displays correctly.
Step 7: Configure External Access
- Open port 80 in the Windows firewall:
- Go to Control Panel > Windows Firewall > Advanced Settings.
- Add a rule to allow incoming connections on port 80.
- Point a domain or IP to your VPS:
- If you have a domain registered with OuiHeberg, configure its DNS to point to your VPS IP address.
Step 8: Install an SSL Certificate (Optional but Recommended)
- Use a tool like Certbot to generate and install an SSL certificate.
- Configure Apache to enforce HTTPS usage.
Conclusion
Your PHP/MySQL site is now hosted on your OuiHeberg Windows VPS. You can manage your site files via C:\wamp64\www\
, create additional databases via phpMyAdmin, and customize WAMP configurations as needed.
For any questions or assistance, feel free to contact OuiHeberg support. 😊
Nome dell'autore
OUIHEBERG SARL
Categorie
Tutoriels
Data
20/11/2024