Created
February 22, 2013 08:23
-
-
Save leon/5011724 to your computer and use it in GitHub Desktop.
Ubuntu play nginx configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Upstart file to make play app start when server starts | |
description "PlayFramework 2" | |
author "Leon Radley <[email protected]>" | |
version "1.0" | |
env USER=myuser | |
env GROUP=mygroup | |
env HOME=/home/myuser/app | |
env PORT=9000 | |
env ADDRESS=127.0.0.1 | |
env CONFIG=production.conf | |
env SBTMEM=256 | |
env EXTRA="-Xms512M -Xmx1024m -server" | |
env RUNEVOLUTIONS=true | |
start on runlevel [2345] | |
stop on runlevel [06] | |
respawn | |
respawn limit 10 5 | |
expect daemon | |
# If you want the upstart script to build play with sbt you can uncomment this | |
# Though you will need sbt on the server and it takes alot of memory | |
#pre-start script | |
# chdir $HOME | |
# sbt clean compile stage -mem $SBTMEM | |
#end script | |
pre-start script | |
#mkdir -p ${LOGDIR} | |
rm -f ${HOME}/RUNNING_PID | |
end script | |
# use --no-close when ubuntu 12.10 is available | |
exec start-stop-daemon --pidfile ${HOME}/RUNNING_PID --chuid $USER:$GROUP --exec ${HOME}/start --background --start -- "$EXTRA -Dconfig.resource=$CONFIG -Dhttp.port=$PORT -Dhttp.address=$ADDRESS -DapplyEvolutions.default=$RUNEVOLUTIONS -DapplyDownEvolutions.default=$RUNEVOLUTIONS" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name www.myapp.com; | |
root /home/myuser/app; | |
include /etc/nginx/proxy_params; | |
location / { | |
proxy_pass http://127.0.0.1:9000; | |
} | |
location = /favicon.ico { log_not_found off; access_log off; } | |
location = /robots.txt { log_not_found off; access_log off; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to run play without nginx iptables can be usedto port forward port 9000 to 80