Skip to content

Instantly share code, notes, and snippets.

@soediro
Forked from ar-android/frebsd_laravel_install.md
Last active December 29, 2020 23:33
Show Gist options
  • Save soediro/583e7e42a552a05863ca53ce3200abd0 to your computer and use it in GitHub Desktop.
Save soediro/583e7e42a552a05863ca53ce3200abd0 to your computer and use it in GitHub Desktop.
Setup FreeBSD 12.1-RELEASE-p11 Server for Laravel

Update Package

sudo pkg update

Install NGINX

sudo pkg install nginx

Install MYSQL Server

sudo pkg install mysql57-server

Install PHP 7.2

sudo pkg install php72-7.2.34 php72-bcmath-7.2.34 php72-composer-1.10.10 php72-ctype-7.2.34 \
    php72-curl-7.2.34 php72-dom-7.2.34 php72-fileinfo-7.2.34 php72-filter-7.2.34 php72-gd-7.2.34 \
    php72-hash-7.2.34 php72-iconv-7.2.34 php72-intl-7.2.34 php72-json-7.2.34 php72-mbstring-7.2.34 \
    php72-mysqli-7.2.34 php72-openssl-7.2.34 php72-pdo-7.2.34 php72-pdo_mysql-7.2.34 php72-phar-7.2.34 \
    php72-session-7.2.34 php72-simplexml-7.2.34 php72-tokenizer-7.2.34 php72-xml-7.2.34 \
    php72-xmlreader-7.2.34 php72-xmlrpc-7.2.34 php72-xmlwriter-7.2.34 php72-zip-7.2.34 php72-zlib-7.2.34

Install Composer

curl https://getcomposer.org/download/1.8.6/composer.phar --output composer.phar \
  && echo "export PATH=${PATH}:/var/www/vendor/bin" >> ~/.bashrc 
sudo mv composer.phar /usr/local/bin/composer

Configure PHP

Copy configure file

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

Config environment variable php

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

Change to this :


cgi.fix_pathinfo=0

listen.owner = www
listen.group = www
listen.mode = 0660

Next rehash

rehash

And enable Service

sudo sysrc nginx_enable=yes mysql_enable=yes php_fpm_enable=yes

Install GIT

sudo pkg install git

Config MYSQL

sudo service mysql-server start

Install Secure MYSQL

sudo mysql_secure_installation

Install REDIS

sudo pkg install redis

Start service Redis

sudo sh -c 'echo redis_enable=\"YES\" >> /etc/rc.conf'
sudo service redis start

Install PHPMYADMIN

wget https://files.phpmyadmin.net/phpMyAdmin/4.7.7/phpMyAdmin-4.7.7-all-languages.zip

pkg install unzip

unzip phpMyAdmin-4.7.7-all-languages.zip

rm phpMyAdmin-4.7.7-all-languages.zip

mv phpMyAdmin-4.7.7-all-languages/ phpmyadmin

cd phpmyadmin/

cp config.sample.inc.php config.inc.php

Nginx config phpmyadmin


server {
    # default server specification
    listen 8083;
    server_name localhost;

    # file location
    root /root/phpmyadmin;
    index index.php index.html index.htm;

    # check if a file or directory index file exists, else route it to 404 error page.
    # else pass the request to the index.php as a query parameter.
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    # error pages
    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }

    # handle execution of PHP files
    # set php5-fpm socket
    # tell NGINX to proxy requests to PHP FPM via the FCGI protocol
    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
    }

}

Restart nginx and php

sudo service nginx restart
sudo service php-fpm restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment