[FreeBSD] Nginx Setup - Printable Version
+- nixers (https://nixers.net)
+-- Forum: Operating Systems (https://nixers.net/forumdisplay.php?fid=4)
+--- Forum: BSD (https://nixers.net/forumdisplay.php?fid=13)
+--- Thread: [FreeBSD] Nginx Setup (/showthread.php?tid=33)
[FreeBSD] Nginx Setup - yrmt - 22-07-2012
Now that you've got your jail configured, let's install the Web Server !
You can achieve that either by the ports or the precompiled packages.
Personally, I prefer using the ports, so in /usr:
When it's finished, install nginx:
or: pkg_add -r -v nginx
Select the options you need.
You can add this in the jail's /etc/rc.conf: nginx_enable="YES"
Or, run it directly with: /usr/local/etc/rc.d/nginx start. Test the nginx is running by going on 192.168.1.10
in your browser. It should say: "Welcome to nginx !"
Nginx's default root directory is in /usr/local/www/nginx and Nginx's configuration is /usr/local/etc/nginx/nginx.conf
Install PHP5, the extensions, spawn-fcgi and mysql
Again, you can use pkg_add if you need this to be done quickly.
Now add these lines in te jail's rc.conf:
Nginx's config file needs to be edited, you can use mine:
Once everything is done, restart the jail and test that Nginx works.
Let's test if PHP works ! Write a little php file in Nginx's root directory.
the php code:
Run 192.168.1.10/phpinfo.php in your browser, if it shows something, you have php working.
This might also be a good time to test that you have the options you need with php.
If it doesn't work, try running this in the jail:
Now that PHP works, let's take care of mysql. I like to install phpmyadmin to manage sql databases.
But you need to create a mysql account first.
-> make a user account in your jail by running adduser.
-> run mysql as root in your jail.
To make a mysql user with all privileges, run this:
( my username is beastie, replace some_pass with the password you want )
The user is created. Now let's install phpmyadmin, you need to fetch it first. You can also install it by ports.
Install wget or curl before, it can be useful: ( copy paste, heh :P )
Access 192.168.1.10/pma is a browser and use your new user and pass from mysql. If everything works you should be logged in
and able to make new databases and tables...
You might get a few warnings from phpmyadmin, just recompile php5-extensions with the appropriate options.
If you want, you may now allow incoming port 80 from your router and forward port 80 to 192.168.1.10 ;), register a hostname
and bam, you have a home server \o/.