web analytics
Home freebsd, linux, others Jails on freenas
freebsdlinuxothers

Jails on freenas

this is my log when I’m using freebsd as web server and mysql server using nginx and php-fpm

 

# iocage console rsyncjail
# pkg update && pkg upgrade
# echo 'sshd_enable="YES"' >> /etc/rc.conf
# service sshd start
# pw useradd -n vivek -G wheel -s /bin/tcsh -m -d /home/vivek
# passwd vivek

pkg install security/sudo

visudo
alice ALL=(ALL) NOPASSWD: ALL

pkg install nano wget mc nginx
sysrc nginx_enable=YES
service nginx start
CREATE USER 'jeffrey'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

my.cnf comment bind_address = 127.0.0.1
pkg install php73 php73-extensions php73-intl php73-composer
pkg install php73-xml php73-hash php73-curl php73-gd php73-tokenizer php73-zlib php73-zip

  * /etc/ssl/cert.pem
  * /usr/local/etc/ssl/cert.pem
  * /usr/local/openssl/cert.pem

# vi /usr/local/etc/php-fpm.d/www.conf
listen = 127.0.0.1:9000
listen = /var/run/php-fpm/php73-fpm.sock
listen.owner = www
listen.group = www
listen.mode = 0660
sysrc php_fpm_enable=YES

cp -v /usr/local/etc/php.ini-production /usr/local/etc/php.ini
vi /usr/local/etc/php/99-custom.ini

display_errors=Off
safe_mode=Off
safe_mode_exec_dir=
safe_mode_allowed_env_vars=PHP_
expose_php=Off
log_errors=On
error_log=/var/log/nginx/php.scripts.log
register_globals=Off
cgi.force_redirect=0
file_uploads=On
allow_url_fopen=Off
sql.safe_mode=Off
disable_functions=show_source, system, shell_exec, passthru, proc_open, proc_nice, exec
max_execution_time=60
memory_limit=60M
upload_max_filesize=2M
post_max_size=2M
cgi.fix_pathinfo=0
sendmail_path=/usr/sbin/sendmail [email protected] -t
short_open_tag = On;
mysql -u hpgcrmuser -p hpgcrm_live < hpgcrm_live-20200620.sql
server {
    listen 80 default_server;
    listen [::]:80 default_server;


    
    root	/var/www/html;
    index	index.html index.htm index.php;
    server_name 192.168.50.190;

    location / {
        try_files $uri $uri/ =404;
    }
    
    location ~ \.php$ {
                try_files $uri /index.php =404;
                fastcgi_pass unix:/var/run/php-fpm/php73-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        fastcgi_read_timeout 1800;
        }

    location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico|woff2)$ {
                expires 30d;
                add_header Cache-Control "public, no-transform";
        }

        client_max_body_size 100M;

        gzip on;
        gzip_types
                text/plain
                text/css
                text/js
                text/xml
                text/javascript
                application/xml
                application/javascript
                application/x-javascript
        ;

    gzip_proxied    no-cache no-store private expired auth;
        gzip_min_length 1000;
    gzip_vary on;
}

remember to check your /var/run/php-fpm folder, mkdir, chmod and chown for www

get your nginx.conf include to /etc/nginx/sites-available, link it to /etc/nginx/sites-enable

and put your cloudflare ssl key/pem to /etc/nginx/ssl

Author

Ronny

Leave a Reply