Skip to content

Commit

Permalink
IBX-3465: Added Nginx vhost template (#1704)
Browse files Browse the repository at this point in the history
  • Loading branch information
glye authored and DominikaK committed Feb 23, 2023
1 parent 3e83312 commit 0a08615
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 147 deletions.
124 changes: 0 additions & 124 deletions code_samples/install/vhost_template/vhost.template

This file was deleted.

56 changes: 35 additions & 21 deletions docs/getting_started/install_ibexa_dxp.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,35 +345,49 @@ for information on how to do it on different systems.

### Set up virtual host

Prepare a [virtual host configuration](https://httpd.apache.org/docs/2.4/vhosts/) for your site.
Prepare a [virtual host configuration](https://en.wikipedia.org/wiki/Virtual_hosting) for your site.

You can copy [the example vhost file](https://github.com/ezsystems/developer-documentation/tree/master/code_samples/install/vhost_template/vhost.template)
to `/etc/apache2/sites-available` as a `.conf` file and modify it to fit your project.
=== "Apache"

Specify `/<your installation directory>/public` as the `DocumentRoot` and `Directory`.
Uncomment the line that starts with `#if [APP_ENV]` and set the value to `prod` or `dev`,
depending on the environment that you are configuring:
You can copy [the example vhost file](https://raw.githubusercontent.com/ibexa/post-install/main/resources/templates/apache2/vhost.template)
to `/etc/apache2/sites-available` as a `.conf` file and modify it to fit your project.

```
SetEnvIf Request_URI ".*" APP_ENV=prod
```
Specify `/<your installation directory>/public` as the `DocumentRoot` and `Directory`, or ensure `BASEDIR` is set in the environment.
Uncomment the line that starts with `#if [APP_ENV]` and set the value to `prod` or `dev`, depending on the environment that you are configuring,
or ensure `APP_ENV` is set in the environment.

#### Enable virtual host
```
SetEnvIf Request_URI ".*" APP_ENV=prod
```

When the virtual host file is ready, enable the virtual host and disable the default:
When the virtual host file is ready, enable the virtual host and disable the default:

``` bash
a2ensite ibexa
a2dissite 000-default.conf
```
``` bash
a2ensite ibexa
a2dissite 000-default.conf
```

Finally, restart the Apache server.
The command may vary depending on your Linux distribution.
For example, on Ubuntu use:
Finally, restart the Apache server.
The command may vary depending on your Linux distribution.
For example, on Ubuntu use:

``` bash
service apache2 restart
```
``` bash
service apache2 restart
```

=== "nginx"

You can use [this example vhost file](https://raw.githubusercontent.com/ibexa/post-install/main/resources/templates/nginx/vhost.template)
and modify it to fit your project. You will also need the `ibexa_params.d` files that should reside in a subdirectory below where the main file is,
[as is shown here](https://github.com/ibexa/post-install/tree/main/resources/templates/nginx).


Specify `/<your installation directory>/public` as the `root`, or ensure `BASEDIR` is set in the environment.
Ensure `APP_ENV` is set to `prod` or `dev` in the environment, depending on the environment that you are configuring, and uncomment the line that starts with `#if[APP_ENV`.

When the virtual host file is ready, enable the virtual host and disable the default.
Finally, restart the nginx server.
The command may vary depending on your Linux distribution.

Open your project in the browser by visiting the domain address, for example `http://localhost:8080`.
You should see the welcome page.
Expand Down
2 changes: 1 addition & 1 deletion docs/infrastructure_and_maintenance/environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ You can configure several environments, such as production, development or stagi

## Web server configuration

For example, using Apache, in the [`VirtualHost` example](https://github.com/ezsystems/developer-documentation/tree/master/code_samples/install/vhost_template/vhost.template) in your installation, the required `VirtualHost` configurations have been already included. You can switch to the desired environment by setting the `ENVIRONMENT` variable to `prod`, `dev` or another custom value, like in the following example:
For example, using Apache, in the [`VirtualHost` example](https://raw.githubusercontent.com/ibexa/post-install/main/resources/templates/apache2/vhost.template) in your installation, the required `VirtualHost` configurations have been already included. You can switch to the desired environment by setting the `ENVIRONMENT` variable to `prod`, `dev` or another custom value, like in the following example:

```
# Environment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ See [Security advisory: EZSA-2020-002.](https://developers.ibexa.co/security-adv
### Block execution of scripts in `var` directory

Make sure the web server blocks the execution of PHP files and other scripts in the `var` directory.
See [vhost.template.](https://github.com/ezsystems/developer-documentation/tree/master/code_samples/install/vhost_template/vhost.template#L80)
See the line below `# Disable .php(3) and other executable extensions in the var directory` in the
[virtual host configuration](https://raw.githubusercontent.com/ibexa/post-install/main/resources/templates/apache2/vhost.template).

### Use secure password hashing

Expand Down

0 comments on commit 0a08615

Please sign in to comment.