English translation
Test Your Website in a Browser
In the previous article, we discussed how to optimize the directory structure of website files for better organization and management. In this article, we’ll explore how to access the test website we prepared earlier via a web browser. Once everything is confirmed to be working correctly, we’ll be ready to officially launch the site.
Deploying the Test Website
Before proceeding, ensure that your test website files have been uploaded into the optimized directory structure established in the previous article. Assume your website file structure looks like this:
/var/www/html/
├── index.html
├── about.html
└── css/
└── styles.css
Here, we’ve created a simple HTML file, index.html, as the test page—you may customize its content according to your needs.
Content of the Test Website Files
You can populate index.html with basic content—for example:
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/styles.css">
<title>Test Website</title>
</head>
<body>
<h1>Welcome to My Test Website</h1>
<p>This is a test website used to verify whether the Apache2 deployment was successful.</p>
</body>
</html>
Ensure the css/styles.css file exists and contains at least minimal styling—for instance:
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
}
h1 {
color: #0066cc;
}
Accessing the Test Website via Browser
-
Confirm that the Apache2 service is running. Check its status in the terminal using:
sudo systemctl status apache2If the service is not running, start it with:
sudo systemctl start apache2 -
Open your web browser and enter your server’s IP address or domain name in the address bar—for example:
http://your_server_ip_or_domain/If all configurations are correct, you should see the content from
index.html. Upon successful access, you’ll observe the heading “Welcome to My Test Website” along with the accompanying paragraph text.
Important Notes
-
Ensure your firewall permits HTTP and HTTPS traffic. Verify UFW settings with:
sudo ufw statusIf HTTP and HTTPS ports are not enabled, run:
sudo ufw allow 'Apache Full' -
If the website fails to load in the browser, use
curlfor diagnostic purposes:curl -I http://your_server_ip_or_domain/This command returns the HTTP headers; check whether the response status is
200 OK.
Next Steps
Once you’ve verified that the test website is accessible without issues, we’ll move on to the next critical step: inspecting Apache2’s status and error logs. This step is essential for promptly identifying and resolving problems when they arise.
By following sound structural practices and configuration rules, our Apache2 website deployment journey continues smoothly—and we hope you’ll successfully complete each stage. In the next article, we’ll delve deeply into how to examine Apache2’s status and error logs.
Continue