Basic Settings

Questions

  • Find the list of ip and ports the apache web server is listening on
  • There is always one main .conf file, the rest of the conf file are add using Include directive.

http.conf

  • Listen : The ip address and port that apache web server should be listening on
Listen 0.0.0.0:89
  • User and group account to be used
User apache
Group apache
  • ServerName : Trying to resolve the server name by ip addresss
ServerName www.example.com
  • ErrorLog : Name of the log file where error will be loged
ErrorLog /var/log/httpd/error.log
  • Include : include is use to include other conf files in the current httpd.conf file
Include conf.d/*.conf

Load all the conf files in the conf.d directory

  • IncludeOptional : Alternatively, the following command will just be ignored in case of missing files or directories:
IncludeOptional conf-enabled/*.conf
  • VirtualHost : The IP and port the apache server to listen to for itself
<VirtualHost *:80>

In the above example, it will listen to all the request on port 80

FQ Example of reverse proxy

<VirtualHost *:80>
        ProxyPass "/" "http://localhost:9090/"
</VirtualHost>

Note : Modules porxy and proxy_http is required to run the proxy

Read Me : https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html

To ensure that and Location: headers generated from the backend are modified to point to the reverse proxy, instead of back to itself, the ProxyPassReverse directive is most often required:

<VirtualHost *:80>
        ProxyPass "/" "http://localhost:9090/"
        ProxyPassReverse "/" "http://localhost:9090/"
</VirtualHost>

Note : If it is a two way communication ProxyPassReverse is required

To restart the apache web server use below command :

sudo systemctl restart apache2

  • LoadModule
    • authz_host_module modules/mod_authz_host.so
      Control access by IP address
    • dir_module module/mod_dir.so
      Default page to be loaded

Note : There will always be folders called sites-available, sites-enabled, conf-available and conf-enabled, We put all the conf file always in the *-available folder and when we want that configuration file to take effect we create a symbolic link on that conf file in the *-enabled folder

Read Me:

https://help.ubuntu.com/lts/serverguide/httpd.html

Leave a Comment