Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1978  / 1 Year ago, tue, march 21, 2023, 10:08:20

I am using Ubuntu and Windows. When I use Windows, i can't access my file in var/www of my Linux partition. So I try to make virtual host and DirectoryRoot in my NTFS partition.



I will combine WAMP directory in the Windows, and the virtual host root directory on Ubuntu, but it does not work. Always appears error 403 forbidden access. And when i change the permissions with chmod nothing change.



What should I do?


More From » server

 Answers
4

Settings for NTFS partition



First you need to be able to access your NTFS partition via Ubuntu. Do the following steps if you haven't.



sudo apt-get install ntfs-3g


Find the name of your NTFS partition(s). Example:



sudo fdisk -l | grep NTFS


Get the UUID of your NTFS partition.



$ sudo blkid
/dev/sda1: LABEL="windows" UUID="4ED2A451B2A23F59" TYPE="ntfs"


Configure the partition in /etc/fstab (make a backup just in case).



sudo cp /etc/fstab /etc/fstab.bak
sudo vim /etc/fstab


I created mine as follows (based on the UUID. The following options set read, write, execute permissions and uid=1000 sets you as the user of the NTFS partition during OS boot. This will also ensure that Apache user can access your virtual host direction (this is what solved my problem).



/dev/disk/by-uuid/4ED2A451B2A23F59 /media/windows ntfs-3g defaults,permissions,users,uid=1000,utf8  0 0


If you want to mount the partition as the www-data user instead, then find the www-data user id and replace uid=1000 with that:



id -u www-data


Note that you may need to create /media/windows directory if it doesn't exist.



cd /media
sudo mkdir windows
sudo chown sagun:users windows


Reboot your computer and confirm that your NTFS drive automounts with read, write, execute permissions enabled.



Settings for configuring Virtual Host in Apache



Create directories to place your log files (if you want):



sudo mkdir /var/log/apache2/projects.dev


Create a new config file inside /etc/apache2/sites-available directory. Example:



sudo vim /etc/apache2/sites-available/projects.dev.conf


Set your configuration similar to this and save the file:



<VirtualHost *:80>
ServerAdmin [email protected]
ServerName projects.dev
ServerAlias projects
DocumentRoot /media/windows/Users/sagun/Dropbox/projects
<Directory />
Options FollowSymLinks
AuthType None
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory /media/windows/Users/sagun/Dropbox/projects/>
Require all granted
Options Indexes FollowSymLinks MultiViews
AuthType None
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/projects.dev/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/projects.dev/access.log combined
</VirtualHost>


Next, edit the /etc/hosts file.



sudo vim /etc/hosts


Add the following line and save:



127.0.0.1   projects.dev


Activate the host with the following command:



sudo a2ensite projects.dev


Restart Apache



sudo service apache2 restart


Finally I was able to go to http://projects.dev from my Browser with all my code residing in NTFS partition from both Windows and Ubuntu. I hope someone finds this useful. Cheers!


[#31555] Wednesday, March 22, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
aslity

Total Points: 336
Total Questions: 133
Total Answers: 98

Location: Zimbabwe
Member since Thu, Jul 21, 2022
2 Years ago
aslity questions
Sat, Apr 22, 23, 23:22, 1 Year ago
Wed, Oct 27, 21, 06:19, 3 Years ago
Sun, Oct 3, 21, 05:33, 3 Years ago
Fri, Jul 1, 22, 17:16, 2 Years ago
;