1

How to setup a firewall for NextCloud on Centos

Asked 3 years ago (Jan 07, 2021) in the field of Operating Systems by Alex

I have NextCloud installed on CentOS but I have a problem with the firewall configuration. please guide me.


Answers


1
Answered 3 years ago (Jan 07, 2021) by Eldernode staff

Dear Alex, well done to install Nextcloud successfully. To be able to set up the firewall, you should make a few configurations for SELINUX to reach your target. Use the following commands and then if you faced any other questions, please feel free to ask me or visit our related article on install nextcloud centos 8.

sudo semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/html/nextcloud/data’ sudo semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/html/nextcloud/config(/.*)?’ sudo semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/html/nextcloud/apps(/.*)?’ sudo semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/html/nextcloud/3rdparty(/.*)?’ sudo semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/html/nextcloud/.htaccess’ sudo semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/html/nextcloud/.user.ini’ sudo restorecon -Rv ‘/var/www/html/nextcloud/

After that, open the webserver port 80 to allow external users to access NextCloud from your server. Type the following commands to do this: sudo firewall-cmd –add-port=80/tcp –zone=public –permanentsudo firewall-cmd –reload

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day