# Reverse Proxy Setup ---------- You may configure OneDev to run behind Nginx or Apache Httpd to do reverse proxying. Below procedure assumes you are running Nginx or Apache Httpd on Ubuntu: ### Nginx 1. Assume your OneDev instance runs at port 6610, and you want to access it via _http://onedev.example.com_. Create a file named _onedev.example.com_ with below content under directory _/etc/nginx/sites-available_: ``` server { listen 80; listen [::]:80; server_name onedev.example.com; # maximum size of uploaded file. Increase this if your repository is very large client_max_body_size 100M; location /wicket/websocket { proxy_pass http://localhost:6610/wicket/websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location /~server { proxy_pass http://localhost:6610/~server; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location / { proxy_pass http://localhost:6610/; } } ``` 1. Then, enable this site and restart Nginx server: ``` sudo ln -s /etc/nginx/sites-available/git.example.com /etc/nginx/sites-enabled/onedev.example.com sudo service nginx restart ``` ### Apache Httpd 1. Make sure you have Apache httpd server version 2.4.5 or higher installed 1. Enable [mod_proxy](http://httpd.apache.org/docs/2.4/mod/mod_proxy.html) by running: ``` sudo a2enmod proxy_http ``` 1. Enable [mod_proxy_wstunnel](http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html) by running: ``` sudo a2enmod proxy_wstunnel ``` 1. Now assume your OneDev instance runs at port 6610, and you want to access it via _http://onedev.example.com_. Create a file named _onedev.example.com.conf_ with below content under _/etc/apache2/sites-available_: ``` ServerName onedev.example.com ProxyRequests Off ProxyPreserveHost Off Order deny,allow Allow from all ProxyPass /wicket/websocket ws://localhost:6610/wicket/websocket ProxyPass /~server ws://localhost:6610/~server ProxyPass / http://localhost:6610/ ProxyPassReverse / http://localhost:6610/ Order allow,deny Allow from all ErrorLog /var/log/apache2/onedev-error.log CustomLog /var/log/apache2/onedev-access.log combined LogLevel warn ``` 1. Then, enable this site and restart Apache httpd server: ``` sudo a2ensite onedev.example.com.conf sudo service apache2 restart ``` ### Caddy Server Running OneDev behind Caddy server is really simple, just start your caddy server as a reverse proxy: ``` caddy reverse-proxy --from onedev.example.com --to localhost:6610 ``` Here we assume that OneDev is running at port 6610, and also you have a DNS record mapping `onedev.example.com` to ip address of the machine running OneDev and Caddy server