Setup Minio Server on Centos 7 and Proxy Pass Using Nginx
At present many options for file storage in the cloud like Aws S3, Google Storage and many more. And not so much people have a budget to have cloud service just for save file on cloud. So in this tutorial we will setup minio server on Centos 7 and setup for Nginx for secure connection minio server and your application
First add some user for minio on Centos 7 using
[centos@server~]# useradd -s /sbin/nologin -d /opt/minio minio
And create some folder for minio apps and configuration file
[centos@server~]# mkdir -p /opt/minio/bin
After we create folder, now download minio binary file and put to minio folder the we create earlier
[centos@server~]# wget https://dl.minio.io/server/minio/release/linux-amd64/minio -O /opt/minio/bin/minio
Change permission file so minio binary can be executed
[centos@server~]# chmod +x /opt/minio/bin/minio
Now we create configuration file for minio to make easier configuration
[centos@server~]# vim /opt/minio/minio.conf
On configuration file we put environment such as port, access key and secret key
MINIO_VOLUMES="/var/www/minio_storage/"
MINIO_OPTS="--address :9100"
MINIO_ACCESS_KEY= Somestrong_Access_key
MINIO_SECRET_KEY= Somestrong_Secret_key
After that we create some folder for minio storage file, and make sure the path folder we using same as we put on configuration file (/opt/minio/minio.conf) and change the owner to minio user
[centos@server~]# mkdir -p /var/www/minio_storage/
[centos@server~]# chown -R minio:minio /var/www/minio_storage/
Now we create system file service so minio can running as a service on background
[centos@server~]# vim /etc/systemd/system/minio.service
And put script service on that file like this
[Unit]
Description=Minio
Documentation=https://docs.minio.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/opt/minio/bin/minio
[Service]
WorkingDirectory=/opt/minioUser=minio
Group=minioPermissionsStartOnly=true
EnvironmentFile=-/opt/minio/minio.conf
ExecStartPre=/bin/bash -c "[ -n \"${MINIO_VOLUMES}\" ] || echo \"Variable MINIO_VOLUMES not set in /opt/minio/minio.conf\""ExecStart=/opt/minio/bin/minio server $MINIO_OPTS $MINIO_VOLUMESStandardOutput=journal
StandardError=inherit# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0# SIGTERM signal is used to stop Minio
KillSignal=SIGTERM
SendSIGKILL=no
SuccessExitStatus=0[Install]
WantedBy=multi-user.target
Reload system daemon on Centos 7 using
[centos@server~]# systemctl daemon-reload
Now start and enable minio service using
[centos@server~]# systemctl start minio
[centos@server~]# systemctl enable minio
And that’s way to install and setup minio apps on Centos 7 now we setup configuration on Nginx Webserver
Before we start, make sure you have Nginx Installation and running well on Centos 7
Make configuration file on Nginx folder configuration
[centos@server~]# vim /etc/nginx/conf.d/minio.conf
And this configuration for Nginx proxy pass
server {
listen 80;
server_name minio.domain.com www.minio.domain.com; #this config will force through ssl / https
return 301 https://$server_name$request_uri; root /var/www/html;
index index.html index.php; access_log /var/log/nginx/minio-access.log;
error_log /var/log/nginx/minio-error.log; location / {
proxy_pass http://localhost:9100;
}
}server {
listen 443;
server_name minio.domain.com www.minio.domain.com;
ssl on;
#change max size upload file as you want
client_max_body_size 300M;
ssl_certificate /path/to/ssl/certificate;
ssl_certificate_key /path/to/ssl/certificate_key; ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on; access_log /var/log/nginx/minio-access.log;
error_log /var/log/nginx/minio-error.log; root /var/www/html;
index index.php; location / {
proxy_pass http://localhost:9100;
proxy_set_header Host $host;
proxy_set_header X-Client-DN $ssl_client_s_dn;
proxy_set_header X-SSL-Subject $ssl_client_s_dn;
proxy_set_header X-SSL-Issuer $ssl_client_i_dn;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
}
}
After that check the configuration file using
[centos@server~]# nginx -t
and restart Nginx for activated configuration
[centos@server~]# systemctl restart nginx
check on browser using domain we setup earlier on nginx configuration
Login using access key and secret key same as we put on minio configuration file (/opt/minio/minio.conf)
So that the tutorial for setup minio server and proxy pass using Nginx webserver, Hopefully can help anyone for save file on cloud using open source application
Tidak ada komentar:
Posting Komentar