• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
set the "document root" to the public folder inside your project

#11
Hmmm - Apache has a public_html or an htdocs folder, but a CI project should go *inside* that, eg. at public_html/myproject or htdocs/myproject. The document root for your website would then be set to "public_html/myproject/public" or "htdocs/myproject/public", either in httpd.conf (if this is the only webapp you are running) or inside extra/httpd-vhosts.conf (if using virtual hosts).

That's what I do Smile
Reply

#12
(07-15-2017, 10:38 AM)ciadmin Wrote: Hmmm - Apache has a public_html or an htdocs folder, but a CI project should go *inside* that, eg. at public_html/myproject or htdocs/myproject. The document root for your website would then be set to "public_html/myproject/public" or "htdocs/myproject/public", either in httpd.conf (if this is the only webapp you are running) or inside extra/httpd-vhosts.conf (if using virtual hosts).

That's what I do Smile


I use vhosts and the one set for john-betong.tk has these settings:
Code:
<VirtualHost *:80>
 ServerAdmin [email protected]
 ServerName john-betong.tk
 ServerAlias www.john-betong.tk
 DocumentRoot /XXX/YYY/ZZZ/john-betong.tk/public_html

 <Directory /XXX/YYY/ZZZ/john-betong.tk/public_html>
   Options +FollowSymlinks +MultiViews
   AllowOverride all
   Require all granted
 </Directory>

 # Error Logging    
   LogLevel warn
   ErrorLog ${APACHE_LOG_DIR}/error-john-betong.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

[br]

file: https:/john-betong.tk/index.php 
PHP Code:
<?php
declare( strict_types=);

// Location to the Paths config file.
// This should be the only line you need to
// edit in this file.
$pathsPath '../application/Config/Paths.php';

// Path to the front controller (this file)
define('FCPATH'__DIR__.DIRECTORY_SEPARATOR);

/*
 *---------------------------------------------------------------
 * BOOTSTRAP THE APPLICATION
 *---------------------------------------------------------------
 * This process sets up the path constants, loads and registers
 * our autoloader, along with Composer's, loads our constants
 * and fires up an environment-specific bootstrapping.
 */

// Ensure the current directory is pointing to the front controller's directory
chdir(__DIR__);

// Load our paths config file
require $pathsPath;
$paths = new Config\Paths();

$app = require rtrim($paths->systemDirectory,'/ ').'/bootstrap.php';

/*
 *---------------------------------------------------------------
 * LAUNCH THE APPLICATION
 *---------------------------------------------------------------
 * Now that everything is setup, it's time to actually fire
 * up the engines and make this app do it's thang.
 */
$app->run(); 

Is there a security problem with the above setup?

Edit:
>>> either in httpd.conf (if this is the only webapp you are running) or inside extra/httpd-vhosts.conf (if using virtual hosts).
I have 10 sites running and they can all access the /XXX/YYY/ZZZ/ci2/CodeIgniter4/system/ directory.
CI4 - Playground:
    https://www.john-betong.tk/test/1/42
CI 3.15  -  AmpProject 
     http://tools.pingdom.com/fpt/#!/uC1KU/ww...-jokes.com

Reply

#13
The problems is with wamp server 64bits definitely. I tried installing codeigniter 4 on windows 7 32 bits with appserv satisfactorily. Just I need to create a virtual host as CodeIgniter4 User Guide explains beacause I have other projects in my DocumentRoot.
Reply

#14
This is the Virtual Host that I use on Windows 10 Pro using XAMPP and PHP 7.1.7.

PHP Code:
# Testing CI 4.0 Dev
<VirtualHost *:80>
 
   DocumentRoot "\xampp\htdocs\ci4\public_html"
 
   ServerName ci4.dev
    
<Directory "\xampp\htdocs\ci4\public_html">
 
       Order allow,deny
        Allow from all
        AllowOverride All
        Require all granted
    
</Directory>
</
VirtualHost

Also on Windows you may need to add the server name to the Windows host file.

c:\Windows\System32\drivers\etc\hosts

You can open it using notepad with administrator mode.

Example:

127.0.0.1 ci4.dev
or
::1 ci4.dev

This works fine for me and I use it all the time.
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
2 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.