How to hide folder routes on EC2 - amazon-ec2

I have an EC2 instance that hosts my site, and I have a question about it, well, I have folders inside the lamp's html folder, example folders are css, js, assets, and the problem is that whenever I type the domain of the site with the route of a folder or any other file, this is opened, example ec2-blah-blah-blah.com/assets (it shows everything inside the folder assets). The question is, how can I hide this? I don't want anyone to have access to folders or x files

Related

Vue.js dist folder when copied to Shared hosting site's subfolder is not rendering and showing a blank page

After successfully running npm run build I copied the contents of the /dist folder in my local wwwroot folder. Everything renders correctly and I an see my page.
The problem comes when I copy the same contents of the /dist folder to a sub-directory on a Shared Hosting site (Domain.com or GoDaddy.com): https://www.mywebsite.com/sub-directory
All I see is a blank page. Upon checking the Network tab in developer tools, I see all requests status come back with 200 Status Code.
At this point I have thrown the towel and would appreciate any help I can get.
I went around my problem and solved it in another fashion. Instead of making a subfolder in /public_html folder, I created a subdomain using the configuration menu. Therefore my site looked like: https://mysubdomain.myoriginalsite.com
While creating a subdomain, the shared-hosting site's configuration asks me what should be the folder for this newly requested subdomain.
So I created a folder in the root (same level as /public_html) called /mysubdomain and copied all my files from /dist folder over there.
It worked like a charm.
Please NOTE: In vue.config.js file I updated my publicPath variable to be '' instead of '/'

How to not create empty folders?

I try to download only images from a certain website, with saving original folder nesting structure, where images are located on the website's server.
In filter settings i setup file types to download like:
+www.example.com/*.gif
+www.example.com/*.jpg
+www.example.com/*.jpeg
+www.example.com/*.png
-www.example.com/*.html
And everything runs OK, but HTTrack crreats empty folders where HTML files should be. In result i have full folder structure of the website, where some folders are empty, and some contain images.
The question is: how could i avoid creating of empty folders? I want only folders, which contain images.

How to find files/folders that change in joomla when content get added from the backend of the site

I need to know which all files or folders can change in joomla when an administrator adds content from backend of the site.If possible list those folders/files
Joomla! uses a database to store all content.
Apart from media files, log files, tmp files and maybe cache, Joomla! does not store anything else in files / folders.
Maybe you can expose your problem more clearly. What do you want to do exactly?

How to download images from the same folder as where the image is uploaded?

I am creating a project wherein the user can upload his photo. This photo is stored in the folder "images/uploads/filename". When his profile is created and the photo is to be shown, I use the <img> tag with src as "images/uploads/filename", but the photo does not show up.
If I manually copy the photo to an adjacent folder "images/abc/filename" and then use it as the source then it works.
How is this caused and how can I solve it? I need to use the same folder to upload and download photos.
That can happen if you're running the webapp as an IDE project and are storing the uploaded images in the IDE's project space. Changes in the IDE's project folder which are performed externally (as by your servlet code) does not immediately get reflected in the deployed server's work folder. Only when you touch it (by refreshing the project) or by copying it (as you happen to have found out), then it will get reflected.
After all, storing uploaded files in the webapp's deploy folder is a bad idea. Those files will get all lost whenever you redeploy the webapp, simply because those files are not contained in the original WAR file.
You need to store them somewhere outside the webapp's deploy folder on a different fixed path like /var/webapp/uploads. You should not use relative paths or getRealPath() to create the File object around it. Just use a fixed path. You can always make the fixed path configureable as a context param setting, a VM argument, a properties file setting or even a JNDI entry.
Then, to serve it to the world wide web, just add exactly that path as another docroot to the server config. It's unclear what server you're using, but in Tomcat it's a matter of adding another <Context> to the server.xml.
See also:
Uploaded image only available after refreshing the page
How I save and retrieve an image on my server in a java webapp
Make sure your have the correct path and include the image extension
just for testing, put your img tag inside the index.php
<img src="images/abc/filename.jpg">
/root/index.php
now put you image in to the your abc/ folder
/root/images/abc/filename.jpg
This should display the image.
if you have your img tag inside another folder in the root like below
/root/user/index.php
now when you use you img tag use this path (relative link):
<img src="../images/abc/filename.jpg">
note the beginning of the image path "../" this is used to go back to the root.
if the php or html file that is holding the img tag is even deeper, just remember to add ../ for every level, 2 folders deep whould be:
<img src="../../images/abc/filename.jpg">
Question was quite vague so hope this is what you are looking for.
let me know and if this is wrong, explain a little more and i will try to help :)

I want to display the image from xampp folder?

Working with PHP. I want to display the images which are in xampp folder not in htdocs (which will be root of the website). How to go about it? I have tried <img src="../../image.jpg", and also tried with src=/image.jpg, not working. Given the total path as src="E:/xampp/image.jpg" still not working. What may be wrong. The file is .php
You can't access pictures (or files) outside of htdocs on a webpage.
There are probably ways to retrieve the image from a directory "lower" than htdocs with PHP (depending on your open_basedir-restrictions), store them somewhere else and let the img-tag display them or really mess with your server settings to allow access ... but why don't you just place the images somewhere in htdocs (or a subdirectory), where they belong?
You cant access images/css sheets etc outside htdocs folder
Make a folder for images in htdocs and use those

Resources