# Installation on v-server as a subfolder with other services in subfolders using apache

**URL:** <https://meta.discourse.org/t/installation-on-v-server-as-a-subfolder-with-other-services-in-subfolders-using-apache/39731>\
**Category:** Self-hosting\
**Created:** [17 فبراير 2016، 12:33م UTC](https://meta.discourse.org/t/installation-on-v-server-as-a-subfolder-with-other-services-in-subfolders-using-apache/39731 "2016-02-17T12:33:08Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)\
**Post date:** [21 فبراير 2016، 4:27م UTC](https://meta.discourse.org/t/installation-on-v-server-as-a-subfolder-with-other-services-in-subfolders-using-apache/39731/22 "2016-02-21T16:27:09Z")

</div>

My recommendation would be:

1. Change your current `server` block to be the block for SSL.
2. Make a new `server` block that redirects all HTTP requests to HTTPs.

For reference, here is such a redirect block:

```nginx
server {
        listen 80;
        server_name domain.com;
        return 301 https://$host$request_uri;
}

```

Here’s how the SSL configuration could look like:

```nginx
server {
        listen 443 ssl;
        server_name domain.com;

        ssl_certificate /etc/ssl/certs/cert.crt;
        ssl_trusted_certificate /etc/ssl/certs/cert.crt;
        ssl_certificate_key /etc/ssl/private/cert.key;

        ssl_ciphers "AES256+EECDH";
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;

        add_header Strict-Transport-Security "max-age=63072000;";
        add_header X-Frame-Options DENY;
        add_header X-Content-Type-Options nosniff;
        ssl_stapling on;
        ssl_stapling_verify on;

        client_max_body_size 20m;

        location / {
                proxy_pass http://unix:/var/discourse/shared/vorkurs/nginx.http.sock:;
                proxy_set_header Host $http_host;
                proxy_http_version 1.1;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                # proxy_redirect http://vorkurs-discourse.cs.uni-saarland.de/ https://vorkurs-discourse.cs.uni-saarland.de/;
        }
}

```

* * *

Watch out: My example enables HSTS. If your site goes live with this configuration, visitors that have seen it will refuse to use http for **up to 2 years**.

---

_[View the full topic](https://meta.discourse.org/t/installation-on-v-server-as-a-subfolder-with-other-services-in-subfolders-using-apache/39731)._
