Apache question.

Kernels & Hardware, configuring network, installing services

Apache question.

Postby hack3rcon » 2020-09-03 21:03

Hello,
I have some questions about Apache configuration and I'm thankful if anyone help me.

1- In Apache configuration, both of "ServerName" and "ServerAlias" must be defined? Which one must have "www" prefix ?

2- If "/etc/pki/tls/private/localhost.key" and
"/etc/ssl/certs/localhost.crt" files deleted then how can I regenerate them? Is below command OK?
Code: Select all
# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/pki/tls/private/localhost.key -out /etc/ssl/certs/localhost.crt


The "localhost" is the name of my host? If my hostname is "example-test" then these files name must be "example-test.key" and "example-test.crt" ?

3- By default, Linux use "localhost.localdomain" if I installed Apache and my web site is up too then can I change "localhost.localdomain" ? Can it make any problem?

4- For a web site with the name "example-test.net" and "192.168.1.2" IP address, what is the content of "/etc/hostname" and "/etc/hosts" files? Is below configuration OK?
Code: Select all
# cat /etc/hostname
#localhost.localdomain
example-test.net

And:
Code: Select all
# cat /etc/hosts
#127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.2   example-test.net   example-test

It is a great help if anyone answer my questions by number.

Thank you.
hack3rcon
 
Posts: 443
Joined: 2015-02-16 09:54

Re: Apache question.

Postby dilberts_left_nut » 2020-09-04 05:08

1 No. Any. Just specify whatever you want the vhost to answer to.
2. Probably - check 'man openssl'
3.Yes. No.
4. Irrelevant. Makes no difference to your webserver.
AdrianTM wrote:There's no hacker in my grandma...
User avatar
dilberts_left_nut
 
Posts: 5077
Joined: 2009-10-05 07:54
Location: enzed

Re: Apache question.

Postby hack3rcon » 2020-09-04 09:18

dilberts_left_nut wrote:1 No. Any. Just specify whatever you want the vhost to answer to.
2. Probably - check 'man openssl'
3.Yes. No.
4. Irrelevant. Makes no difference to your webserver.


Thank you for your reply. I asked that questions because of HTTPS certificate.

1- If they are not important then what is their usage? I think Let's Encrypt see the Apache configuration or Virtual Host configuration file for select the website name automatically.
4- I got a certificate when my server name was "localhost.localdomain" and when I changed the "hostname" and "hosts" files then it cause some problem. If these files make no difference to my server then why they exist?
The /etc/hosts is an operating system file that translate hostnames or domain names to IP addresses.
The /etc/hostname contains name of the machine, as known to applications that run locally.

They are not important for get a HTTPS certificate?
hack3rcon
 
Posts: 443
Joined: 2015-02-16 09:54

Re: Apache question.

Postby reinob » 2020-09-04 09:38

You should really ask the questions you have instead of about other questions/solutions that you think might be related.

You get a certificate for a domain, which should resolve to a publically addressable IP address (i.e. not 192.168.. or such).
Apache configuration is another thing. Maybe it's time you really RTFM before you continue.

Apache has excellent documentation.
Certbot (if that's what you're using for letsencrypt) is also very well documented.
reinob
 
Posts: 819
Joined: 2014-06-30 11:42

Re: Apache question.

Postby hack3rcon » 2020-09-04 17:05

reinob wrote:You should really ask the questions you have instead of about other questions/solutions that you think might be related.

You get a certificate for a domain, which should resolve to a publically addressable IP address (i.e. not 192.168.. or such).
Apache configuration is another thing. Maybe it's time you really RTFM before you continue.

Apache has excellent documentation.
Certbot (if that's what you're using for letsencrypt) is also very well documented.

As I said, the IP is an example and I know that it must a public IP.
hack3rcon
 
Posts: 443
Joined: 2015-02-16 09:54

Re: Apache question.

Postby cuckooflew » 2020-09-04 20:52

reinob wrote:You should really ask the questions you have instead of about other questions/solutions that you think might be related.

You get a certificate for a domain, which should resolve to a publically addressable IP address (i.e. not 192.168.. or such).
Apache configuration is another thing. Maybe it's time you really RTFM before you continue.

Apache has excellent documentation.
Certbot (if that's what you're using for letsencrypt) is also very well documented.
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!
cuckooflew
 
Posts: 683
Joined: 2018-05-10 19:34
Location: Some where out west


Return to System configuration

Who is online

Users browsing this forum: No registered users and 14 guests

fashionable