• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About deploy a Codeigniter Web in Azure

Hi Everybody!!

I need some help, i'm trying to deploy a codeigniter proyect on azure (web app), but i having some troubles, first i have the files like that:

- public
    - myproject
         - application
               - config
                     - database.php
                     - config.php
                     - routes.php
         - system
         - template
                - js
                - css
         - index.php
         - web.config
         - .htaccess

When i accesing my url (https://xpbc-app-2018.azurewebsites.net/ ) i get a 404 error, so i have to add /login to my page to load... and css and js files are not found.. 

this is my web.config:
<?xml version="1.0" encoding="UTF-8"?>
            <rule name="Imported Rule 1" stopProcessing="true">
               <match url="^(.*)$" />
               <action type="Rewrite" url="/index.php/{R:1}" />

and this is my .htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt|sitemap\.xml|template)
RewriteRule ^(.*)$ index.php/$1 [L]

HELP!! im not understanding nothing.. a guide could be my salvation.  Some advices please..

Thanks to all
(Sorry for my poor english)

You need to change your base URL in application/config.php. That's why your CSS aren't loading.

You got this at the moment.
<link rel="stylesheet" href="https://xpbc-app-2018.azurewebsites.net/xpbc2017/template/assets/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="https://xpbc-app-2018.azurewebsites.net/xpbc2017/template/assets/plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="https://xpbc-app-2018.azurewebsites.net/xpbc2017/template/assets/fonts/style.css">

You are appending xpbc2017 for some reason.

Regarding 404 you need to enable the debug log in application/config.php and look for errors in /application/logs/. You can try to change to your default controller into w/e your login controller are named. So you know that's it your default controllers fault or not.

HI jreklund! Thanks for your answer,

actually this is my config file:

defined('BASEPATH') OR exit('No direct script access allowed');
$config['base_url'] = 'https://xpbc-app-2018.azurewebsites.net/xpbc2017/';
$config['index_page'] = ' ';
$config['uri_protocol'] = 'REQUEST_URI';
$config['url_suffix'] = '';
$config['language']     = 'english';
$config['charset'] = 'UTF-8';
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = 'MY_';
$config['composer_autoload'] = FALSE;
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
$config['allow_get_array'] = TRUE;
$config['log_threshold'] = 0;
$config['log_path'] = '';
$config['log_file_extension'] = '';
$config['log_file_permissions'] = 0644;
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['error_views_path'] = '';
$config['cache_path'] = '';
$config['cache_query_string'] = FALSE;
$config['encryption_key'] = 'mypass';
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'cisession';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['cookie_prefix']        = '';
$config['cookie_domain']        = '';
$config['cookie_path']          = '/';
$config['cookie_secure']        = FALSE;
$config['cookie_httponly']      = FALSE;
$config['standardize_newlines'] = FALSE;
$config['global_xss_filtering'] = FALSE;
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
$config['compress_output'] = FALSE;
$config['rewrite_short_tags'] = FALSE;
$config['proxy_ips'] = '';

And that is why i dont undestand, why i got those errors... i check that all files in "template" exist in my server.

Actually im appending to xpbc2017  because "myproject" directory is called "xpbc2017" inside of it there are application,system,templates directories..

I still having same problems to upload css and js files :S.

I always think when people are first deploying a site to a new platform they should keep things simple.

#1 Have a simple site with only one page and no css.
#2 See if it works without a .htaccess file, and the index.php extension.

Once these are in place then you can start trouble shooting the other things. The .htaccess file is the thing I do at the very end. Often, sometimes it is a case of trial and error, amending one line at a time.

It could be anything, it could even be a database connection error, go to the index.php file and set the variable to 'testing' instead of production to get more detailed error messages.
Practical guide to IgnitedCMS - Book coming soon

Ok, if that's the case. It's your web.config fault. You are rewriting every url to your index.php. Including css and js. You can delete your .htaccess, it's a IIS platform.

Try this:
<?xml version="1.0" encoding="UTF-8"?>
            <rule name="Rule" stopProcessing="true">
              <match url="^(.*)$" ignoreCase="false" />
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
              <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />

Hi jreklund!!

I appreciate your help so much, i was losing my hope trying to configure this, I really appreciate it!!

I tried the code in my web.config, still not working, you can check it.

But i found that my default controller was wrong... i had my login controller in a sub directory in controllers.. that is why i got 404 error.. now i fixed it, but still css and js not loading... If you have another idea please let me know..
Thanks so much.

This works now with the updated web.config:

But this dosen't:

So remove xpbc2017 from your base_url.

Hi jreklund!!!

Hey! Thanks so much! You helped me a lot! Finally css is loading.. I have to change more things but no for configuration issues..
I really appreciate your helpful tips and advices..


Your welcome! I'm glad everything worked out in the end.

Aryam Wrote:Hi Jreklund!

Sorry for disturbing you again, can you help please??
Im having some troubles again in my codeigniter project in azure, this time the controllers send me a 404 error, i was trying taking out from subdirectories but it doesn' t work.. Can you tell some advices just to try it?

Thanks so much! Confused

Normally when i get 404 errors I make a comment block /* */ around all code (in that function, that are giving you a problem). And at the end you will have found the source of problem. As you move down your /* block down the code.

PS. You got private message disabled, so I can't answer you.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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