I have moved website from one hosting to another and due to security, PCI and HIPPA reason, I need to move some (files and images) directories outside html folder.
Previous structure : /public_html/uploads
Current structure : /var/www/uploads
For Files : /var/www/html/
I want to know how I can handle uploaded images and images get to display on front page.
Thanks
You could use symbolic links e.g.:
in /var/www/html execute ln -s /var/www/uploads image_uploads then all your images can be referenced with <img src="/image_uploads/some_image_name.jpg">
Be aware than you may need to set alternative permissions in a <Directory> section in your site configuration (I am assuming that you are using Apache).
Something like
<Directory "/var/www/uploads">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
See the Apache documentation for Directory for more information.
Related
Talking about my project I am working, its just a simple website in localhost.I am Xampp server rand inside htdocs my website is in file creative which contains index.php file and another sub directory themes which further contains themes folder which contain all the necessary html php and css files that builds my websites.
When a user enters I want to redirect him from the index.php in localhost/creative to the index.php in localhost/creative/themes/theme-folder. I tried to use require_once('creative/themes/theme-folder/index.php'); but in most of cases it fails. is there any other way to do so.
You can modify the .httpd file.
Then you add:
#The path of your repositories:
DocumentRoot "C:/xampp/htdocs/creative"
#then you make an alias:
Alias /creative "C:/xampp/htdocs/creative/themes/theme-folder"
<Directory "C:/xampp/htdocs/creative/themes/theme-folder">
#Modify this data according to your needs
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
I have a php application located in /var/www/phpapp and I need to create links to download files located in the /home/myuser folder. The complete path to the files is stored in a database, so the goal is for the app to place a link like Download 1 and be able to download it. I access the php app using http://localhost/phpapp. I know I can do this using alias in apache but I still haven't figure it out.
For anyone having this same problem, I got it working using this:
In Ubuntu: I went to /etc/apache2/sites-enabled/ and edit the site file
In Centos: Go to /etc/httpd/conf.d/ and add a new xxxx.conf file
And I added this into the file:
Alias /home "/home/user/"
<Directory "/home/user">
Options None
AllowOverride None
Order allow,deny
Allow from all
Options Indexes FollowSymLinks
MultiViews Require all granted
</Directory>
I am very new to web servers , php, etc. I built a small web server using Apache 2.2.22 on ubuntu 12.04 LTS. The webpage is for local access only and can be viewed by other devices connected to the access point (No thereat of security). The document root directory is /var/www/, I edited the default index.html file to display what I want to see.
Here I am trying to display few images which is in /home/myname/somedir/, but the images are not displayed. I cannot save the images to the web document root as the images are being updated regularly by another program. How do i access the images and display them.
Things I have tried so far:
Symbolic / soft link
Aliasing: added this to the default configuration file /etc/apache2/sites-available/default
Alias /images/ "/home/myname/somedir/"
<Directory "/home/myna-me/somedir/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
php script: I used the following code in a php script `cam_images.php'
and I called them in the hmtl file as /cam_images.php?file=myfile.jpg referred from here
None of them have worked so far. I'm not sure where I am going wrong. I have also tried readfile() in php, but the function isn't able to open that file. I even tried moving the DocumentRoot to the same directory as of the images but the webpage was not shown
(you don't have permission to access / of the server)
Any help is appreciated.
Thanks
Please check the PHP user has an access to /home/myname/somedir/. Usually only user itself has access to /home/user, so most probably that is the reason.
To fix the permissions:
chmod o+rx /home/myname
chmod -R o+rx /gome/myname/somedir
I'm trying to figure out how to tell Netbeans to load the index file that is inside of my public_html folder when the project is ran and I'm not sure how to.
Sources : http://screencast.com/t/kWMCRKOWoo
Run Configuration : http://screencast.com/t/SqZTN7Pu
EDIT :
Can anybody expand on the answer below? Any additional ideas with seeing my two screenshots.
Rightclick on the project in the project explorer.
Click Properties.
Select Run Configurations under categories section.
Update the Project url & Index file fields.
Done ! :)
Update Project folder & Source folder too under sources category if those are incorrect.
You can via localhost only run files inside
http://localhost/WrestlingManager/index.php
and that is mapped to
C:\xampp\htdocs\WrestlingManager\index.php
and that's what you have set in your run configuration.
It's easy if you can run in a browser (for example).
http://localhost/WrestlingManager/public_html/index.php
If you want to run files from another location . You must that folder have in your server conf file
Alias /public_html = "C:/Netbeans/Projects/PhpApp1/public_html"
from my Apache httpd.conf
Alias /samples "D:/mysamples/xysamples"
<Directory "D:/mysamples/xysamples">
Options Indexes FollowSymLinks MultiViews ExecCGI
Order allow,deny
Allow from all
</Directory>
Now I can : http:/localhost/samples
I can not see the real path of the public_html folder inside of your Netbeans project .
In Run configuration you can set
Project URL : http://localhost/WrestlingManager/public_html/
Index File : index.php
I have a number of files stored in a folder outside of the publicly accessible portion of my website.
For example, the file 'abcd.jpg' is stored (in terms of the server) in '/home/private_files/' and the website is in '/home/public_html/website.com/'
When I go to provide a link to view the file, I use
Download however this doesn't work.
Any suggestions?
If you are using Apache as the server, you can set it to alias a directory in httpd.conf...
Alias /images/ "/home/private_files/"
<Directory "/home/private_files/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</IfModule>
and you can use this
Download
You can not access to directory that located in out of www.
use symlink to link to file:
ln -s /home/private_files/abcd.jpg /home/www/abcd.jpg
and delete the link after deadline(something like rapidshare)
or use file downloader like this