-3

I installed CentOS7 and Apache on my work PC (connected to my company's network with a given IP address). No other OS installed, just Linux. I created a simple hello.html file in /var/www folder. I typed /var/www/hello.html in the web browser and I could see the text hello world. So far so good.

  1. Now, how do I access the same basic web page from a different computer on my company's network?

  2. I know Apache listens to PORT 80 for incoming requests. So how do I open up PORT 80?

  3. In my case, hello.html is the source file for my web page. On my Linux PC browser, I can type /var/www/hello.html to see the page. But suppose I want to call my website www.mywebsite.com. How do I translate from /var/www/html to www.mywebsite.com. In other words, when I direct other coworkers to my website, I want to give them www.mywebsite.com as a name, and not /var/www/hello.html, which would be meaningless to them.

  4. Based on question 3, does this mean that I have to create a "local" DNS that somehow combines my IP address along with hello.html into www.mywebsite.com?

closed as too broad by terdon Sep 5 '14 at 18:50

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • You'll probably want to put the file under /var/www/html since that's the default DocumentRoot for apache on CentOS/RHEL. – Bratchley Sep 5 '14 at 18:39
  • 2
    Please don't combine multiple questions on a single post. Also, most of your questions are unanswereable unless you give us a lot more information about how your company's network is set up. You might also want to read the apache documentation or any simple networking tutorial to have a basic idea of how a web server works. – terdon Sep 5 '14 at 18:50
3

Assuming 1.2.3.4 is your web server's IP, you may use:

http://1.2.3.4/hello.html

.. to access your web page, provided your Apache server is configured correctly. If your machine has a domain name attached to it, you may use it as well since it resolves to 1.2.3.4. If this machine is hidden behind a router (which is usually the case on a home network), you'll probably have to setup a port forwarding rule in your router configuration to map your external port 80 to your web server's.

Since Apache is listening on port 80, its service is already available, unless you (or your network administrator) specifically blocked incoming traffic through this port. There is no notion of opening a port here.

Configuring your domain name to point to a specific directory (in your case, /var/www) is done through Apache virtual hosts, the documentation for which can be found found here.

Another part of your domain setup is to make sure it resolves to your machine. Unless you have experience in this field, I would not recommend you to setup your own DNS server, for reliability purposes. Use your registrar's control panel to setup an A DNS record for your domain, pointing to your machine's IP. Since each provider offers a different way to set this up, you'll need to have a look at their help & support resources.

  • Thank you. I have not succeeded yet, but am reading your links. – user82350 Sep 5 '14 at 17:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.