Correct file permissions for website directory - filesystems

I have a sub-domain for my website where I have all of my CSS, images, and various other files. What I am trying to do is make it inaccessible to the public if you go to the URL of say http://subdomain.domain/images but accessible if you go to the actual file, say http://subdomain.domain/images/image.jpg. I can't figure out what permissions should be on the files and folders, I only seem to make it all inaccessible or all accessible. The reason for this is because some of the files on the subdomain are going to be users personal files which they can view and upload through the website and an app, I obviously don't want these files to be publicly accessible.
I have tried Googling this and couldn't find anything that helped.

It looks like you don't want to fiddle with filesystems or file-permissions but with a setting in your webserver of choice to disable directory browsing/listing.
On IIS it is called Directory Browsing
On Apache it is called Directory Listing, specific the settinng Options -Indexes
On WHM in cPanel you disable that in the Index Manager

Related

What is the easiest way to push a file on the GCP AppEngine?

To verify the ownership of a domain to a mail service, I need to put a file with a specific name for verification. Is there a better way than pushing it into my app source repository?
For security reasons you would have to put the file in your source and do a deployment to App Engine. If you’ve worked with a traditional web server in the past where you basically dump files into a folder and serve them this will be a bit of a change. The App Engine files are going to execute only. If you want to get in to adding other files on the fly you would need a Cloud Storage Bucket, but I don’t think that will do it for your domain verification.

How do I refresh resources folder of web application?

I'm developing a web application in which I want to insert users and be able to display files that they upload via a search option. I can get all of the logic that I need sorted and the files uploaded into the correct directory. However, if I insert a new user into the db, the web app cannot find their file in the directory until I restart the server.
How can I make it so that the resources directory of my web app automatically gets refreshed by the server? I'm developing in Java/JSP and using Tomcat as my server.
Thanks!!
I'm guessing you're putting the files into the src/main/resources folder, then it's being packaged into the artifact and then you access them as the classpath resources. Then the next portion of the resources is going to be available after the next packaging.
Instead you should access the Files via usual File System and Absolute or Relative paths.

Serve Drupal from Site Root

I've researching this for over a month now and I'm very frustrated. What I want to do seems very doable but I'm frustrated that there doesn't seem to be one simple answer to this issue.
I've installed Drupal on a domain on a Virtual Private Server. The software is installed by the hosting service using Plesk but they don't support the software or Drupal, so I'm on my own.
When Plesk installs Drupal, it does so in a 'drupal' folder so when you navigate to the site, it says http://domainname.com/drupal But I want Drupal to run the entire site from the root. I don't want "drupal" to appear anywhere.
The answers I've seen say that you need to add an .htaccess file that provides a redirect and then to edit the .htaccess file in the Drupal folder and the settings.php file. But when I do this the site throws an error and I can't login to the drupal interface.
I am not a programmer or coder. I've created many HTML sites and even a WordPress site, but WordPress is so much easier to set up this way. So, sorry if this is really a lame question, but I need to know whether I need to re-install drupal in the root folder or if I can get it to actually serve drupal from the root by editing these files.
I'm able to access the site via SSH and edit or create any file needed.
Here are my questions:
Can I get Drupal to run from the root by simply editing the drupal/.htaccess file, the settings.php file and by adding an .htaccess file in the site root? If not, what do I need to do?
Do I need to move the drupal index.php file to the site root or create a new index file? None of the instructions say anything about this.
After editing those files and creating a new .htaccess file will I be able to login and manage the site properly?
Does anyone have a link to a set of instructions for a complete drupal novice? Any help in this endeavor would be greatly appreciated.

How to get setup.exe folder path for ClickOnce

I have a click once Application which is deployed in folder say, "c:\temp\MyApp". In this folder I have a config file "MyAppDynamic.config" which I want my click once app to read when it starts.
When I click on c:\temp\MyApp\setup.exe, ClickOnce App is deployed in %APPDATA%.. folder and hence I am not able to get the folder location from where clickonce is launched.
Is there a way to get the launch location in clickonce app?
Am I doing something wrong?
Thanks,
RDV
Little more info:
My clickonce app's main purpose is to install a bunch of pre-reqs on client box. These pre-reqs can be located anywhere on network (their location changes depending upon whether the particular component is in development or production). I did not want to update the clickonce installer just because some dynamic location changed and thats why I do not want to hardcode the installation paths in ClickOnce app.
Hence, I am using an external file "MyAppDynamic.config" where I update the installation paths of all components and I place this file in the published folder where setup.exe resides.
The problem is I want to read this file when ClickOnce application starts, but any System/Environment variable wont give me this published location because by this time, ClickOnce is already deployed on Client Box and all Location/CodeBase paths point to %APPDATA%..
Question:
Is it possible for a deployed clickonce application to get its installation directory path (I verified IsolatedStorage does not provide this information)?
Is above not not possible, are there any ideas how to achieve this? Again I do not even want to hardcode location of MyAppDynmaic.config file. But if nothing else work, this is going to be my best bet :-(
Thanks,
RDV
There is no way to get or set location of installation. Installation folder is under Isolated Storage for security purpose. You can read your config file. Check this answer;
How can I get the application's path in a .NET console application?

Deployment of static directory contents to google app engine

I've deployed my first GAE application and I am getting "TemplateDoesNotExist" exception at my main page. It feels like my static directory content is not uploaded to GAE.
Isn't it possible that I update (appcfg.py update myapp/) all my files including the static ones and run it standalone on myappid.appspot.com ?
by the way here you can see the problem:
http://pollbook.appspot.com
PS: my app works perfect locally
Your templates should not be stored in a directory that you refer to as "static" in app.yaml. Static directories are for literally static files that will be served to end users by the CDN without changing. These files cannot be read by the templating engine. It works locally because the dev_appserver does not precisely emulate the production server.
Put your templates in a different directory like /templates or something. You do not need to refer to this directory in your app.yaml.

Resources