-
Notifications
You must be signed in to change notification settings - Fork 86
Nginx and Thin
→ Note: This is kept here for internal documentation only, but it is not recommended to be used and is probably outdated!
This is a draft with tips on how to serve Mconf-Web using Thin and Nginx. If you have a better solution of if you found any errors please contact us.
Add thin to the Mconf-Web Gemfile:
gem 'thin'
Install it:
bundle install
Test if Thin is ok:
bundle exec thin start
Create a config file to run Thin (replace <MCONF_WEB_PATH>
with the path to your application):
thin config -C mconf-web.yml -c <MCONF_WEB_PATH> --servers 3 -e production -p 3000
Create a virtual host for Mconf-Web in Nginx:
sudo vim /etc/nginx/sites-available/mconf-web
Put this content in this file (replace <YOUR_IP>
and <MCONF_WEB_PATH>
with real values):
upstream thin {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
server {
listen 80;
server_name <YOUR_IP>;
access_log <MCONF_WEB_PATH>/log/access.log;
error_log <MCONF_WEB_PATH>/log/error.log;
root <MCONF_WEB_PATH>/public/;
index index.html;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://thin;
break;
}
}
}
Enable the virtual host:
sudo ln -s /etc/nginx/sites-available/mconf-web /etc/nginx/sites-enabled/mconf-web
To serve the application you need to run both Thin and Nginx:
thin start -C mconf-web.yml
sudo /etc/init.d/nginx restart
This is the technical documentation for Mconf-Web, a component of Mconf. Read more about the project and try it out at mconf.org.
- Home
- Releases
- Changelog
- FAQ
- Translating the application
- Latest stable version (2.x.x)
- Development version (from branch
master
) - Previous version (0.8.x)