flyingfisch
flyingfisch

Reputation: 529

Subdirectories in openshift project cannot be found

I built a site using a php openshift project and accessing the root directory via http works fine. However, all the root directories give me a 404 not found, like this one: http://test.toppagedesign.com/sites/

I checked with ssh, and /app-root/repo/sites and app-deployments/current/repo/sites/ both exist.

EDIT Added a directory called php and now I have 503 errors for everything...

EDIT 2

I deleted the php directory, now the 503 errors are gone. However, I do still get 404 errors for the subdirectory.

Here is my directory tree: http://pastebin.com/hzPCsCua

And I do use git to deploy my project.

Upvotes: 0

Views: 508

Answers (2)

ʀɣαɳĵ
ʀɣαɳĵ

Reputation: 1982

This sounds like it could be a problem with how you are serving your static content.

I recently created a new sample app for OpenShift that includes:

  1. a basic static folder
  2. an .htaccess file (for serving assets in production)
  3. support for using php's local server to handle the static content (in your dev environments)
  4. Composer and Silex - a great starting point for most new PHP apps

You can serve the project locally if you have PHP-5.4 (or better), available in your dev environment:

php -S localhost:8080 -t static app.php

For a more advanced project that is built on the same foundation, take a look at this PHP+MongoDB mapping example. I wrote up a blog post with some notes on my process for composing that app as well.

Hope these examples help!

Upvotes: 1

user2879327
user2879327

Reputation:

php is one of the alternate document roots that you can use, please see the March Release blog post here about this (https://www.openshift.com/blogs/openshift-online-march-2014-release-blog)

As for the sub-directories not working, can you ssh into your server and use the "tree" command to post the directory/file structure of your project? Also are you using Git to deploy your project or editing files directly on the server?

You need to have an index.php or index.html file in any directory that you want to work like app-domain.rhcloud.com/sites , if you just have sub-directories, how would it know what to show? Also, indexing (showing a folders contents) is not enabled for security reasons, and I believe there is no way to enable it.

Upvotes: 1

Related Questions