Setting up your own FEMP Stack - FreeBSD Server with Wordpress + PHP 7.0

sidious

Administrator
Apr 13, 2005
3
0
13
Servers are great, here's a tutorial on my favorite stack, FEMP (FreeBSD 11, NGINX, MariaDB, PHP 70)

Step 1 

Install packages

sudo pkg install nginx mysql56-server

Step 2

Install PHP +  Modules for Wordpress

sudo pkg install php70-extensions php70-session php70-opcache  php70-xmlwriter php70-xmlreader php70-dom php70-simplexml php70-ctype php70-posix php70-filter php70-json php70-sqlite3 sqlite3 php70-pdo_sqlite php70-pdo php70-iconv php70-phar

Step 3

Config files

sudo cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

sudo nano /usr/local/etc/php.ini

cgi.fix_pathinfo=0

rehash

Step 4 

Enable services

sudo sysrc nginx_enable=yes mysql_enable=yes php_fpm_enable=yes

sudo service nginx start

sudo service mysql-server start

sudo service php-fpm start

Step 6 

NGINX Conf

    server {

        listen 80;

        server_name yoursite.com

        return 301 https://yoursite.com$request_uri;

    }

    server {

        listen 443 ssl http2;

        listen [::]:443 ssl http2;

        server_name yoursite.com;

        root /usr/local/www/html/yoursite/htdocs;

        index index.php index.html index.htm;

#       include global/ssl_common.conf;

        ssl on;

        ssl_certificate /usr/local/www/html/yoursite/ssl/ssl.crt;

        ssl_certificate_key /usr/local/www/html/yoursite/ssl/ssl.key;

        #include global/restrictions.conf;

        location / {

                # try_files $uri $uri/ =404;

                try_files $uri $uri/ /index.php?q=$uri&$args;

        }

        error_page 404 /404;

        error_page 500 502 503 504 /50x.html;

        location = /50x.html {

                root /usr/share/nginx/html;                   

        }

        location ~ \.php$ {

                try_files $uri =404;

                fastcgi_split_path_info ^(.+\.php)(/.+)$;

                fastcgi_pass unix:/var/run/php-fpm.sock;

                fastcgi_index index.php;

                fastcgi_param SCRIPT_FILENAME $request_filename;

                include fastcgi_params;

        }

 
Last edited by a moderator:

henry carter

New member
Nov 25, 2017
1
0
0
44
asa ansdk asl as dlsa las lsa