{"id":7628,"date":"2018-06-23T09:50:20","date_gmt":"2018-06-23T01:50:20","guid":{"rendered":"http:\/\/rmohan.com\/?p=7628"},"modified":"2018-06-23T09:50:20","modified_gmt":"2018-06-23T01:50:20","slug":"disable-default-webpage","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7628","title":{"rendered":"disable default webpage"},"content":{"rendered":"<p>Once it is done, you shall disable Apache&#8217;s default welcome page.<\/p>\n<p>[root@rmohan.com ~]# sed -i &#8216;s\/^\/#&amp;\/g&#8217; \/etc\/httpd\/conf.d\/welcome.conf<\/p>\n<p>Also, prevent the Apache web server from displaying files within the web directory.<\/p>\n<p>[root@rmohan.com ~]# sed -i &#8220;s\/Options Indexes FollowSymLinks\/Options FollowSymLinks\/&#8221; \/etc\/httpd\/conf\/httpd.conf<\/p>\n<p>After that, start and enable the Apache web server.<\/p>\n<p>[root@rmohan.com ~]# systemctl start httpd.service<br \/>\n[root@rmohan.com ~]# systemctl enable httpd.service<br \/>\nCreated symlink from \/etc\/systemd\/system\/multi-user.target.wants\/httpd.service to \/usr\/lib\/systemd\/system\/httpd.service.<br \/>\nSetup WebDAV<\/p>\n<p>For Apache, there are three WebDAV-related modules which will be loaded by default when an Apache web server is getting started.<\/p>\n<p>[root@rmohan.com ~]# httpd -M | grep dav<br \/>\ndav_module (shared)<br \/>\ndav_fs_module (shared)<br \/>\ndav_lock_module (shared)<\/p>\n<p>Next, create a dedicated directory for WebDAV:<\/p>\n<p>[root@rmohan.com ~]# mkdir \/var\/www\/html\/webdav<br \/>\n[root@rmohan.com ~]# chown -R apache:apache \/var\/www\/html<br \/>\n[root@rmohan.com ~]# chmod -R 755 \/var\/www\/html<\/p>\n<p>For security purposes, you need to create a user account.<\/p>\n<p>[root@rmohan.com ~]# htpasswd -c \/etc\/httpd\/.htpasswd user1<br \/>\nNew password:<br \/>\nRe-type new password:<br \/>\nAdding password for user user1<\/p>\n<p>And also, you need to modify the owner and permissions in order to enhance security<\/p>\n<p>[root@rmohan.com ~]# chown root:apache \/etc\/httpd\/.htpasswd<br \/>\n[root@rmohan.com ~]# chmod 640 \/etc\/httpd\/.htpasswd<\/p>\n<p>Once it is done, you need to create a VirtialHost for WebDAV.<\/p>\n<p>[root@rmohan.com ~]# vi \/etc\/httpd\/conf.d\/webdav.conf<br \/>\nDavLockDB \/var\/www\/html\/DavLock<br \/>\n&lt;VirtualHost *:80&gt;<br \/>\nServerAdmin webmaster@localhost<br \/>\nDocumentRoot \/var\/www\/html\/webdav\/<br \/>\nErrorLog \/var\/log\/httpd\/error.log<br \/>\nCustomLog \/var\/log\/httpd\/access.log combined<br \/>\nAlias \/webdav \/var\/www\/html\/webdav<br \/>\n&lt;Directory \/var\/www\/html\/webdav&gt;<br \/>\nDAV On<br \/>\nAuthType Basic<br \/>\nAuthName &#8220;webdav&#8221;<br \/>\nAuthUserFile \/etc\/httpd\/.htpasswd<br \/>\nRequire valid-user<br \/>\n&lt;\/Directory&gt;<br \/>\n&lt;\/VirtualHost&gt;<\/p>\n<p>Once the VirtualHost is configured, you need to restart Apache to put your changes into effect.<\/p>\n<p>[root@rmohan.com ~]# systemctl restart httpd.service<\/p>\n<p>Test the functionality of the WebDAV server from a local machine. In order to take advantage of WebDAV, you need to use a qualified client. For example, you can install a program called cadaver on a CentOS 7 desktop<\/p>\n<p>[root@rmohan.com ~]# yum install cadaver<br \/>\nLoaded plugins: fastestmirror, langpacks<br \/>\nLoading mirror speeds from cached hostfile<br \/>\n* base: mirror.dhakacom.com<br \/>\n* epel: mirror2.totbb.net<br \/>\n* extras: mirrors.viethosting.com<br \/>\n* updates: centos-hn.viettelidc.com.vn<br \/>\nResolving Dependencies<br \/>\n&#8211;&gt; Running transaction check<br \/>\n&#8212;&gt; Package cadaver.x86_64 0:0.23.3-9.el7 will be installed<br \/>\n&#8211;&gt; Finished Dependency Resolution<\/p>\n<p>.<br \/>\n.<br \/>\nRunning transaction<br \/>\nInstalling : cadaver-0.23.3-9.el7.x86_64 1\/1<br \/>\nVerifying : cadaver-0.23.3-9.el7.x86_64 1\/1<\/p>\n<p>Installed:<br \/>\ncadaver.x86_64 0:0.23.3-9.el7<\/p>\n<p>Complete!<\/p>\n<p>Having cadaver installed, use the following command to access the WebDAV server.<\/p>\n<p>[root@rmohan.com ~]# cadaver http:\/\/192.168.7.234\/webdav\/<br \/>\nAuthentication required for webdav on server `192.168.7.234&#8242;:<br \/>\nUsername: user1<br \/>\nPassword:<br \/>\ndav:\/webdav\/&gt;<\/p>\n<p>In the cadaver shell, you can upload and organize files as you wish. Here are some examples. To upload a local file<\/p>\n<p>dav:\/webdav\/&gt; put \/root\/Desktop\/rmohan.com.txt<br \/>\nUploading \/root\/Desktop\/rmohan.com.txt to `\/webdav\/rmohan.com.txt&#8217;: succeeded.<\/p>\n<p>To create a directory &#8220;dir1&#8221; on the WebDAV server<\/p>\n<p>dav:\/webdav\/&gt; mkdir dir<\/p>\n<p>To quit the cadaver shell<\/p>\n<p>dav:\/webdav\/&gt; exit<br \/>\nConnection to `192.168.7.234&#8242; closed.<br \/>\nIf you want to learn more about cadaver, you can look up the cadaver manual in the Bash shell. With this, the tutorial on setting up a WebDAV Server Using Apache on CentOS 7 comes to an end.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Once it is done, you shall disable Apache&#8217;s default welcome page.<\/p>\n<p>[root@rmohan.com ~]# sed -i &#8216;s\/^\/#&amp;\/g&#8217; \/etc\/httpd\/conf.d\/welcome.conf<\/p>\n<p>Also, prevent the Apache web server from displaying files within the web directory.<\/p>\n<p>[root@rmohan.com ~]# sed -i &#8220;s\/Options Indexes FollowSymLinks\/Options FollowSymLinks\/&#8221; \/etc\/httpd\/conf\/httpd.conf<\/p>\n<p>After that, start and enable the Apache web server.<\/p>\n<p>[root@rmohan.com ~]# systemctl start httpd.service [root@rmohan.com ~]# [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7628"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7628"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7628\/revisions"}],"predecessor-version":[{"id":7629,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7628\/revisions\/7629"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}