Vhost configuration on devilbox

Hi, I need help, because I need to configure my localhost /with devilbox/ for this the same as:
I need correct vhost template for this below…

<VirtualHost :443>
ServerName site-on-my-local-1.loc
ServerAdmin me@mail.com
SSLEngine on
SSLCertificateFile “/etc/apache2/ssl/domain.pem”
SSLCertificateKeyFile “/etc/apache2/ssl/domain.key”
SSLCACertificateFile “/etc/apache2/ssl/domain.intermediate”
DocumentRoot /home/witek/projects/symfony/web
SetEnv APPLICATION_ENV development
Require all granted
AllowOverride All
Allow from All

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
ProxyPassMatch ^/(..php(/.)?)$ fcgi:// ErrorLog {APACHE_LOG_DIR}/error_jobtool2.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access_.log combined

Enybody can help me ?

This is something that could also be applied by adding the following to .env


See here for more info: https://devilbox.readthedocs.io/en/latest/intermediate/add-custom-environment-variables.html

For changing the vhost configuration have a look at this page: https://devilbox.readthedocs.io/en/latest/vhost-gen/customize-specific-virtual-host.html

Note the refers to the IP address of the webserver which does not have a a service running on port 9071, I suppose it is running on the PHP container, so that line should rather be:

 ProxyPassMatch ^/(..php(/.)?)$ fcgi://php:9071/home/witek/projects/symfony/web/1 ErrorLog {APACHE_LOG_DIR}/error_jobtool2.log

Additionally I am not quite sure what is serving the PHP files on port 9071 what kind of service is running here?

This part can also be easily added to the vhost-gen config file: https://devilbox.readthedocs.io/en/latest/vhost-gen/customize-specific-virtual-host.html

I managed this with a custom config for Apache 2.4: apache24.yml

I marked the changed lines with # Your changes here


# Apache 2.4 vHost Template defintion for vhost-gen.py
# The 'feature' section contains optional features that can be enabled via
# conf.yml and will then be replaced into the main vhost ('structure' section)
# into their corresponding position:
#    __XDOMAIN_REQ__
#    __PHP_FPM__
#    __ALIASES__
#    __DENIES__
#    __STATUS__
# The features itself also contain variables to be adjusted in conf.yml
# and will then be replaced in their corresponding feature section
# before being replaced into the vhost section (if enabled):
#    __PHP_ADDR__
#    __PHP_PORT__
# XDomain:
#    __REGEX__
# Alias:
#    __REGEX__
#    __PATH__
# Deny:
#    __REGEX__
# Status:
#    __REGEX__
# Variables to be replaced directly in the vhost configuration can also be set
# in conf.yml and include:
#    __VHOST_NAME__
#    __INDEX__
#    __ACCESS_LOG__
#    __ERROR_LOG__
#    __PHP_ADDR__
#    __PHP_PORT__

### Basic vHost skeleton
vhost: |
  <VirtualHost __DEFAULT_VHOST__:__PORT__>
      ServerName __VHOST_NAME__
      Protocols  __HTTP_PROTO__

      CustomLog  "__ACCESS_LOG__" combined
      ErrorLog   "__ERROR_LOG__"

      # Custom directives

### vHost Type (normal or reverse proxy)
  # Normal vHost (-p)
  docroot: |
    # Your changes here
    SetEnv APPLICATION_ENV development
    # /Your changes here

    # Define the vhost to serve files
    DocumentRoot "__DOCUMENT_ROOT__"
    <Directory "__DOCUMENT_ROOT__">

        DirectoryIndex __INDEX__

        AllowOverride All
        Options All

        # Your changes here
        RewriteEngine On
        RewriteCond %{HTTP:Authorization} ^(.)
        RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
        # /Your changes here

        Order allow,deny
        Allow from all
        Require all granted

  # Reverse Proxy (-r)
  rproxy: |
    # Define the vhost to reverse proxy
    ProxyRequests On
    ProxyPreserveHost On

### Optional features to be enabled in vHost

  # SSL Configuration
  ssl: |
    SSLEngine on
    SSLCertificateFile    "__SSL_PATH_CRT__"
    SSLCertificateKeyFile "__SSL_PATH_KEY__"
    SSLProtocol           __SSL_PROTOCOLS__
    SSLHonorCipherOrder   __SSL_HONOR_CIPHER_ORDER__
    SSLCipherSuite        __SSL_CIPHERS__

  # Redirect to SSL directive
  redirect: |
    RedirectMatch (.*) https://__VHOST_NAME__:__SSL_PORT__$1

  # PHP-FPM will not be applied to a reverse proxy!
  php_fpm: |
    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://__PHP_ADDR__:__PHP_PORT____DOCUMENT_ROOT__/$1 timeout=__PHP_TIMEOUT__

  alias: |
    # Alias Definition
    Alias "__ALIAS__" "__PATH____ALIAS__"
    <Location "__ALIAS__">
    <Directory "__PATH____ALIAS__">
        Order allow,deny
        Allow from all
        Require all granted

  deny: |
    # Deny Definition
    <FilesMatch "__REGEX__">
        Order allow,deny
        Deny from all

  server_status: |
    # Status Page
    <Location __REGEX__>
        SetHandler server-status
        Order allow,deny
        Allow from all
        Require all granted

  xdomain_request: |
    # Allow cross domain request from these hosts
    SetEnvIf Origin "__REGEX__" AccessControlAllowOrigin=$0
    Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
    Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
    Header always set Access-Control-Max-Age "0"
    Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
    # Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request.
    RewriteEngine On
    RewriteRule ^(.*)$ $1 [R=200,L]
1 Like

I will send here my .yml with these proposals if I will have still problem.

Hi guys, I’ve got a problem because I’m not administrator of my Windows Laptop, how can I do to see my project because I can’t edit /etc/hosts on my computer.

I currently have a backend on Windows installed wsl2 and Ubuntu 20.04. I’m running devilbox with wordpress built into docker without docker desktop. I need to perform a dev configuration for production on this Windows computer so that I can understand this whole process for maintaining the sites that I may put on the air. In production I’m currently using a weblink hpanel that needs to be powered by this Wordpress which is on my Windows backend. I need an instruction on how to configure the hosts and devilbox configuration files correctly to get the later WordPress sites into production. In other words, I need a step-by-step ASSISTANCE from the export related to the described environment (devilbox) to production (hpanel-weblink).
Note I’m a noob but I understand some settings about the v-hosts configuration files, “/etc/hosts” and also the .env file. I’m even using the variable “TDL_SUFFIX=com.br.loc” Thank you first of all!