FreeBSD Web Server 01 - Nginx Config Explained, PHP and MySQL Setup

preview_player
Показать описание


pkg install nginx mysql56-server php56 php56-mysql
rehash

mysql_enable="YES"
nginx_enable="YES"
php_fpm_enable="YES"

cd /usr/local/etc

service php-fpm start # sudo
service mysql-server start # sudo

mysql_secure_installation # sudo
service mysql-server restart # sudo

service nginx start # sudo

user www;
worker_processes 8;

(configure server block)

root /usr/local/www/nginx;

location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}

mkdir -p /var/log/nginx # sudo
rm /usr/local/www/nginx # sudo
mkdir /usr/local/www/nginx # sudo

nginx -t # sudo
service nginx restart # sudo

TEST via HTTP

Рекомендации по теме
Комментарии
Автор

How did your Nginx -t returned a successful result when the root document path doesn't exist?
Sounds weird to me.
Thanks

linuxmq
Автор

Hi! There is this question bugging me - what's that statusbar on the bottom of the screen? As I can see connection is made with putty, so that must be some screen manager, but which one?

cakulsarnis
Автор

Is your friend a younger cousin of Arnold?

drewerving
Автор

I use CentOS with NGINX only for HTTP/HTTPS proxy. This runs over a XEN virtualizer. You see advantages switching my install to a FreeBSD?

antgod
Автор

Arnis Cakuls I'm using i3 as my window manager :-D. Switched about a year ago and haven't looked back.

tutoriaLinux
Автор

Cool & useful tutorial. Thanks. Any chance of seeing a part 2 anytime soon?

StefanoPapaleo-TS
Автор

Awesome, when can we expect the next steps to caching. Please we can do with your help. 

Maybe even a Moodle FreeBSD 10.1 Nginx install would be something that has not been done before, properly.

waynegibson
Автор

Where is the part II
would this work with PHP7
How do i setup multiple webserver

ependisilalahi
Автор

Unrelated personal question: From the accent I figured that Christian is most likely German. Now I am wondering, since you pronounced his name on German, are you also German or do you have some German roots? Sorry if that's too personal, I am just curious :D

pcfreak
Автор

You should never edit the rc.conf for anything. The php-fpm is called a UNIX socket. cgi.fix_pathinfo= doesn't need to be set anymore! Some configuration is correct but I would never follow this video and the guy talking in background is wrong about 50% of what he's talking about. Video is wrong, it should actually be removed from youtube.

unixfly