I have a development server at dev.mysite.com and I am working with coda and git to make commits and pushes to the repo which has a developmenet branch that points to my dev domain.
The file structure as of right now is this. As of right now does anyone see anything that I should reconsider changing. I'm asking this because of having a public_html inside the dev folder or what. With this setup currently when I load dev.mysite.com it shows the index of / which shows .gitignore, .git, and public_html.
../
/dev
/mysite.com
.git
.gitignore
/application
/public_html
/assets
index.php
/system
/mysecondsite.com
/application
/public_html
/assets
/index.php
/system
/sites
/mysecondsite.com
/application
/system
index.php
Does anybody have any ideas?
If you want to have a development environment and a production environment. While having the core files for CI outside of a public_html. You have to redefine your document root. I assume you are using a server the comes with cPanel as your means of administration for your server.
So that said, you go into your cpanel and where you defined your dev subdomain, you should be able to edit the document root folder. So on the server in your dev folder you will add a public_html like I gather you already have from the example above. And with your current folder settings for dev you add /public_html to the string that is the folder path now.
Once you do that allow a minute or two for it to delegate to the server from cPanel. And move your folders around as you see fit.
From there, you find the root index.php and open that up, find the references for your application folder and your system folder and change them to match the paths they should be looking for now. Likely using relative paths.. ie: ../../applications for example. Save your index.php
Assuming you have done everything in general correct your copy of CI should load correctly as it did when you didnt have everything in the folders split up like you want..
Related
i'm new to bluemix, and don't know how to change the default index to look to public folder of the zend application, so have a php starter build, pushed the application to server, and when i call my_url, it's showing the default index file, and when i type my_url/public it's showing the zend index page ( obviously ).I want when i type my_url/ to take me to public/ folder by deafult.
So has anyone had this kind of "problem"... Searched on their forums, but there is nothing about this case...
Check out the docs here. https://github.com/cloudfoundry/php-buildpack/blob/master/docs/usage.md
The easiest way to use the build pack is to put your assets and PHP files into a directory and push it to CloudFoundry. When you do this, the build pack will take your files and automatically move them into the WEBDIR (defaults to htdocs) folder, which is the directory where your chosen web server looks for the files.
Additionally if you place anything in the lib dir it will not be publically aviailable.
If you place a file in root of your app called .bp-config/options.json you can override the htdocs dir.
https://github.com/cloudfoundry/php-buildpack/blob/master/docs/config.md#httpd-nginx-and-php-configurations
WEBDIR Set a custom location for your web or public files. This is the root directory from which the web server will host your files and the root directory from which PHP-FPM will look for your PHP files. Defaults to htdocs. Other common settings are public, static or html. Path is relative to /home/vcap/app.
I'm working on small project, and will host it on normal Godaddy host plan, the problem is: all file system will be accessible through internet.
so, how can I prevent access to any folder or file except /public
CONTRIBUTING.md
app/
artisan
bootstrap/
composer.json
composer.lock
phpunit.xml
public/
server.php
vendor/
thanks,
Why not split the project up? Upload the contents of public to your document root and the rest somewhere else (like your home directory). Then just modify the two paths in the public/index.php file to point to the right locations, eg
$path = __DIR__ . '/../my-app';
require $path . '/bootstrap/autoload.php';
$app = require_once $path . '/bootstrap/start.php';
If you point your apache site document root to /public, there is no way people can access any other file in your application outside your public. Even if they try to do things like:
http://yoursite.com/../
EDIT:
This is not something you should rely on a framework to do, securing directories on your site is the web server job, so you need to find a solution on your server: virtual host, document root, web root, domain directory or even .htaccess configuration.
In some shared hosting companies you can do that easily, some have cPanel or Plesk, but other, like Hostgator, will give you just enough configuration so you can change your directory root to /public. Looks like GoDaddy doesn't help much if you don't have a cPanel account, but, still, there are tricks to help you doing it the way you should be doing: http://support.godaddy.com/help/article/4067/setting-up-a-non-web-accessible-root-folder. Probably there are others around.
I have a VPS and use PHP 5.5 and Apache 2.2 on a 64bit CentOS.
I have many domains on this VPS that used a shared library named core.
each Domain redirect to a directory with same name in apache html's directory. to be clear, this directory's structure is like this:
cd /var/www/html/
ls
core
site1_dir
site2_dir
site3_dir
site4_dir
...
for example http://www.site1.com root directory is /var/www/html/site1_dir
but there are many files and libraries in core that can't be address like this:
http://www.site1.com/../core/etc
so i created an empty folder, named core in each site's directory and i want to put a .htaccess file in them, in ordor to access core contents in each domains. for example:
http://www.site1.com/core/js/script.js must be a direct link from /var/www/html/core/js/script.js .
creating this .htaccess file is my question, and any other given options will be useful for me.
You should be able to create a symlink in each dir to the upper core dir and then work the files that way.
how can i know where is my web root folder ?
and how to put folders out of web root folder?
and how to test that they are not accessible from outside ?
the structure of my hosting is like this:
www.website.com :
public_html/
includes /
logs/
...
is it enough to protect includes folder and logs folder with htaccess? and are they out of web root in this case?
i know that $server[document root] provide the root of my website , but i am confused about how to put files out of it , any help would be welcome , thanks for all
All your files are currently in the public web root folder.
The 'inside' of your root is your publichtml/. Everything you place in there will be publicly accessible.
The name of your root can vary from host to host, often public_html or httpdocs.
The 'outside' is one directory up. But remember some hosts do not give enough permissions.
You cannot test documents outside your root, because they are not accessible. Only something like PHP can access those files. That's why you do not place your img/JS/CSS files outside the root cause they need direct access.
You can however serve them through your PHP.
Since i don't think i got right permissions all over my application folders and files is there anyway to check the right permissions allover them?
I mean, does anyone knows/has a standard/tutorial/link to follow for Codeigniter to set chmod permissions?
thanks, any help appriaciated!
NB: when i say allover i mean from the root to all files the application & system folders contains
Also to specify little bit, i think i got problems with permissions, cause i passed my application through different OS and for example macosx setted different permissions on directories than windows etc... so it's sort of a hell actually
This is my app schema:
/project
/application
/system
/css
/img
/vendor
index.php
.htaccess
You want to:
chmod -R 0644 application system index.php
Assuming that CI is installed in the web root, with the application/ and system/ directories residing therein, which is the default setup.
What I typically do is put the application/ and system/ directories outside of the web root when I use Codeigniter, at which point you need to edit your index.php file to reflect that:
$system_path = '../system';
$application_folder = '../application';
Note, you'd be adding the ../ (and also need to move those directories one level down) but I digress. The permissions for each directory should be 0755 and for each .php file 0644, wherever you end up putting them. This includes any vendor, 3rdparty, sparks, etc, and any custom asset locations.
If using a templating engine of some sort, good setups will work with 0755 folder permissions at the location where the engine writes its output and intermediate output if applicable. If you find that breaking, find a host that supports suexec so that you don't have to make those locations 777 (or world writeable).
This is most easily done using a terminal (SSH), but should also be easily possible with whatever file manager thingadongdong your host provides.
change the permission of your codeigniter folder with this command:
$ sudo chmod -R 755 /var/www/html/Codeigniter_folder_name