-
Notifications
You must be signed in to change notification settings - Fork 18
InstallNginxFreeBSD
I'm writing this document as I deploy to my FreeBSD workstation to have a local running copy. This is a work in progress, but you may find it helpful which is why I'm putting it here.
- Python 2.6 or Python 2.7 is installed (I used Python 2.7.6 for this article)
- nginx 1.2.9+ with FastCGI support and HTTP SSL support enabled (I used 1.4.4 for this article)
- fcgiwrap 1.0+ is installed
Ports:
- lang/python27
- www/nginx
- www/fcgiwrap
Run the following, which describes your profile, socket, and the number of preforks to use.
echo 'fcgiwrap_enable="YES"' >> /etc/rc.conf
echo 'fcgiwrap_flags="-c 4"' >> /etc/rc.conf
echo 'fcgiwrap_profiles="nginx"' >> /etc/rc.conf
echo 'fcgiwrap_nginx_socket="unix:/tmp/fcgiwrap.nginx.socket"' >> /etc/rc.conf
Start fcgiwrap with "/usr/local/etc/rc.d/fcgiwrap start"
Run the following
echo 'nginx_enable="YES"' >> /etc/rc.conf
Create a new nginx configuration file for your site at /usr/local/etc/nginx/rip.conf
server {
listen 80;
server_name localhost;
root /usr/local/www/rip;
## See http://wiki.nginx.org/Pitfalls
access_log /var/log/nginx/rip_access.log combined;
error_log /var/log/nginx/rip_error.log info;
log_not_found off;
## You may need to create /var/log/nginx
location / {
try_files $uri $uri/ @proxy;
}
## This combination of directives is important, because it handles static
## files through nginx instead of trying to forcefully pass them to fastcgi
location @proxy {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/tmp/fcgiwrap.nginx.socket;
}
## Redirect server error pages to the static /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
}
Make sure you've included rip.conf in your main nginx.conf, set your workers, and commented out the default server block.
Then start nginx with "/usr/local/etc/rc.d/nginx start" It will perform a configtest on start and you'll know quickly if you broke something.
In theory all of the above should work. I got rip to come up, but unfortunately I get some errors and it's unusable. I see the following
error while contacting server:
status:200
parsererror: "SyntaxError: Unexpected token #"
I'm still troubleshooting, and will see if this is code related or configuration related once I dig further into the codebase.