Skip to content

ngrogg/apache-vhost-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apache Vhost Generator

Overview

BASH script for generating an Apache Vhost. Designed for DEB and RPM servers.

Usage

  • help/help, Display help message and exit.

  • generate/Generate, generate Apache Vhost.
    Script is guided, saves to locally generated output folder.
    To bypass guide and generate vhost the following questions are asked :

    • What is the domain?, Ex. rustyspoon.com
      Enter a string.
    • Is there a WWW redirect?, Ex. www.rustyspoon.com
      If there isn't any kind of CNAME redirect this is likely to be no.
      Enter "1" for yes, or "0" for no.
    • Should HTTP traffic redirect to HTTPS?.
      In most cases this will be port 80 traffic to port 443.
      There may be cases where this action is not desired.
      Enter "1" for yes, or "0" for no.
    • Is the site a WordPress site?
      If the site is a WordPress site the script will add some security flags for the uploads directory.
      Enter "1" for yes, or "0" for no.
    • Is there a Docroot?
      If the VirtualHost is on a server where the site files are, a Docroot should be defined.
      This configures a generic DocRoot that should be reviewed after Vhost is created.
      While there may be exceptions, this option should not be used with the "Proxy Pass" option following.
      Enter "1" for yes, or "0" for no.
    • Is there a Proxy Pass?
      If the VirtualHost is being configured to proxy traffic to another server, a Proxy Pass should be defined.
      While there may be exceptions, this option should not be used with the preceeding "Docroot" option.
      Enter "1" for yes, or "0" for no.

      Usage. ./apacheVhostGenerator.sh DOMAIN WWW_REDIRECT? HTTP_TO_HTTPS? WORDPRESS? DOCROOT? PROXY_PASS?
      Ex. ./apacheVhostGenerator.sh rustyspoon.com 1 1 0 1 0

    IMPORTANT: Vhost will need reviewed before used as some values are generic! See next section for details.

Review

Once the VirtualHost is generated at least the following items should be reviewed before the VirtualHost is used:

  • SSL Certifications, script will put placeholder SSL filepaths in place.
    These should be updated before the VirtualHost is used.
  • SSL Protocols, script will put a few SSL Protocols in place.
    These are probably fine but may not cover all use cases.
  • SSL Ciphers, script will put a few SSL Ciphers in place.
    These will probably need expanded to be used safely in a Production environment.
  • ProxyPass, if ProxyPass option is used a placeholder variable is put in place.
    Use sed or whatever find and replace tool is preferred to replace the placeholder SERVER_IP with the actual server's IP.
  • Docroot, if Docroot option is used a placeholder docroot based on the domain is added.
    Adjust to whatever preferred docroot is used.
    • Docroot Options, Some default Docroot options are put in place as well. These may also need updated depending on use case.
  • WordPress, If WordPress option is used some default configurations are put in place for the uploads directory.
    These may require adjustment depending on configuration requirements.
    The filepath is also based on the docroot configuration and may need reviewed as well.
  • File Security changes, these are simple placeholders and cover a few encountered examples.
    These may need adjusted and should be reviewed before deployment.

About

Boilerplate BASH script for generating an Apache Vhost.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages