Receiving a 403 Forbidden on static files but I can't use SSH - nginx

I've been looking around for hours on how to fix this. Every answer I look at involves using a cli to assign permissions and change user groups and the like. Unfortunately, my host will not allow me to use SSH so all I can do is use the Plesk 12.5.30 cpanel. This means my options are very limited in terms of problem solving.
So far I have tried assigning 755 permissions to everything via my FTP client, creating a new FTP user, and moving the forbidden file to the root
Relavent info:
the only forbidden file is my main css file
the files are sitting in a subdomain
creating a blank HTML template file via the cpanel in the same folder as the css file does not throw a 403
putting the css in a style tag in the HTML template causes a 403
I hate my host but I can't switch
Is there anything I can do short of pleading with my boss' boss to change hosting providers?

Related

Wordpress File Uploader Error in Godaddy Managed WP Hosting

I am in a really interesting situation right now.
After migrating a client website from a development environment using, WP Clone by WP Academy, I get this error when trying to upload images via the Worpress media uploader.
“image.png” has failed to upload due to an error
Unable to create directory uploads/2015/07. Is its parent directory writable by the server?
I logged into Godaddy and change the entire uploads/ folder permission via ssh to 777 (crazy enough). And all its contents.
I still got the same error.
After probing a little deeper, I found out the website is running from a different location than the machine i am sshed into.
What do I mean?
When I run pwd via ssh, to see my current working directory I get.
-bash-4.2$ pwd
/home/clientname/html/wp-content/uploads
But In the Wordpress setting at, Settings -> Media
The option "store uploads in this folder" has a value of
/home4/d***71/public_html/website.url/wp-content/uploads
Meaning The site files are copied and hosted in a different location than that given via the SSH, This is probably due to the fact that Godaddy's managed wordpress hosting has some special cache setting configured beyond the control of the user.
The problem now is how do I correct the File Permission issue and have my uploads working properly.
:)
I am just adding this, if anyone ran into the same issue in future.
Log into your GoDaddy account.
Go to the Hosting page.
Click Manage
Select File Manager for the domain you want to edit the permission (this is, if you have multiple domains)
Navigate to the folder where you have installed the WordPress.
Hover on the 'wp-content' and you should able to see an arrow, click to see the option called 'Change Permissions'.
You should able to see all the Permission details in this window.
login into your godaddy panel and click file manager
click or open your project folder
locate upload folder and click on check box
click into the privacy icon and check inherit an SET ALL SUB FOLDERS TO INHERIT PERMISSIONS both checkboxes
The "Hover" didn't work for me. What DID work was to go to the directory above, put ONE check in a box for a DIRECTORY (not a file), and then click on "Privacy".
GoDaddy Permissions
If you check more than one folder, OR a file, you won't get the permissions eyeball to light up.
So, to fix a file permission you would have to go to the level above, and change "Set all subfolders to inherit permissions".
Apparently you can't change some files and not others - just the parent folder, which then sets all the files (is my guess).
This is NOT a limitation of Windows, it's the broken way they establish permissions.
Anyway - hopefully that will work. Tech support confirmed the drop down doesn't work anymore.
== John ==

Wordpress 403 error when moved site to another host

I restored my files and database to new hosting. But when I try to access my blog I get the following error:
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Its been 6 days now I have been trying to fix this issue. Please help.
For me it was this line in .htaccess (it selects the php version to be used):
AddType application/x-httpd-php54 .php
I just comment it out and it worked after that.
Look in your wp-config.php file. Make sure that everything points to the new hosting addresses and logins and nothing refers to the old hosting.
Also be sure that there are no cached files you're transferring over through FTP.
Lastly once the site resolves the 403, be sure your CSS files (depending on what plugins you're using) all point to the proper path of your new hosting.

Local Silverstripe instance site pointing to live site for assets

I have an instance of Silverstripe that we have copied off a webserver that we host. We are trying to get it running locally so we can modify it but when I run it locally all assets point to the live site. Also I cannot access the login, or Admin pages of the CMS.
When I try access any local pages it states "Server Error" in the page content
Is there a place in the code where I can change the paths to assets to local, and also access the Admin area?
Assuming you're running a local copy of the database, and don't have any exotic changes to the way File is handled SilverStripe should be resolving file paths using the BASE_PATH and BASE_URL constants.
For logging in you'll want to add to the bottom of mysite/_config.php locally something like:
define('SS_ENVIRONMENT_TYPE', 'dev');
SSViewer::set_source_file_comments(true);
ini_set('display_errors', 0);
error_reporting(E_ALL);
Security::setDefaultAdmin('admin', 'admin');
// Email::setAdminEmail('admin#example.org');
define('SS_LOG_FILE',dirname(__FILE__).'/'.basename(dirname(dirname(__FILE__))).'.log');
ini_set('error_log', SS_LOG_FILE);
Director::set_environment_type('dev');
This should give you enough debug information to solve most issues.
I would use something like https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ (which also works for Silverstripe), to do a search and replace for all occurences of the old domain.
This would mainly work for images paths that are inside of content fields of course. Otherwise, SS should automatically convert the paths, as the accepted answer suggests.

Is there a way to download a PHP/ASP/whatever source code without processing it, as plain text?

Suppose the URL http://example.com/test.php. If I type this URL on the browser address bar, the PHP code is executed, and its output is returned to me. Fine. But, what if instead of executing it, I wanted to view it's source as plain text. Is there a a way to issue such request?
I believe that there must be some way, and my concern is that some outsider could retrieve sensitive code, such as configurations file, by guessing it's location. For example, Joomla instalations have a configuration.php on it's root folder. If someone retrieves such file as plain text, then these database credentials have been seriously compromised. Obviously, this could be prevented with proper permissions, but it's just too common to just issue 0777 as everything permissions and forgetting about access denials.
For PHP: if properly configured, there is no way to download it. File permissions won't help either way, as the webserver needs to be able to read the files, and that's the one serving contents. However. a webserver can for instance be configured to serve them with x-httpd-php-source, or the PHP/webserver configuration may be broken. Which is why files which don't need direct access (db config, class definitions, etc.) should be outside the document root, so there is no way those files will get served by accident even when the webserver config is incorrect / failing. If your current hoster does not allow you to store files outside the document root, switch hosting a.s.a.p.
There is a way to issue such request that downloads the source code of http://example.com/test.php if the server is configured to provide a URL to do so. Usually it isn't, so usually there is no way to issue such a request.

Drupal Export of Site Not Working For Subdirectory Levels Beyond Root Directory

I have to move an existing Drupal site from one server to another. I've done so by doing a mysql database export/import and copying over the files to the new server. On the new system, the root page comes up fine but if I try to go to any deeper directory levels I get a 404 Not Found Error.
so drupal.newserver.com -> works fine
but drupal.newserver.com/user -> gives me a 404 and happens,same for all subdirectories
Is there something that I'm missing that is part of a drupal export? Could it be related to the structure of the /sites directory which is under the webserver's docroot?- which has a folder named after the old server (ie drupal.oldserver.com but not drupal.newserver.com? Also, I noticed that there are _htaccess files and .hta files but not .htaccess files in the site files that I've copied over.
Sorry if I'm asking a bleedingly obvious question - I'm very new to Drupal. Thank you!
Check whether the clean url is enabled in your web server. To check try this:
drupal.newserver.com/?q=user.
Just to let anyone who might come across via a google search - I was able to get this to work . It turns out that while mod_rewrite was enabled, what I had to do was to enable the AllowOverride directive for the web directory in httpd.conf to be set to ‘All’. If it’s not set to this, the server won’t respect the .htaccess rules you put into the drupal directory. It’s been a while since I’ve worked with apache config files so it took a while to finally piece it together. The main breakthrough came when I realized that if I turned off clean-urls then the links worked but looked ugly and then was able to research clean_url.

Resources