routes working only in local |
Hello,
I developed my project in local and the routes work perfectly: PHP Code: $route['default_controller'] = 'home'; But when I try to move the project on my vps the all routes except of the default_controller it is not working. This is the message: Code: 404 Page Not Found How can I fix?
For example in local I use domain.local/folder/index.php/acp/ and I go to login.
In the same way mydomain.com/folder/index.php/acp/ return the 404 error. In local I use apache, in my hosting I have xginx. This is the problem?
Hey StratoKyke,
If you're using nginx on your live server, you have to adapt one of the .conf files. Nginx does NOT use .htaccess files, so without changes to your nginx server, CI won't work. That's all I know about this matter. I have almost no experience with configuring nginx, I'm sorry... I hope someone with nginx experience can help you. -Roger
Thanks for the reply.
I wonder if there is a configuration that you can make on codeigniter to fit nginx.
Codeigniter has nothing to do with the server it's being run on. The server, whether it's Apache, NGINX, LightHTTP, IIS or something else it needs to be set up to run the PHP application, whether it's CI or WordPress or something else. The application can't alter to webserver to "make itself run". No webserver runs PHP by default, except maybe PHP's built-in webserver.
Here's a working NGINX conf for a CI site: Code: server { The main things you would need to change with your values are: Code: server_name YOUR_SERVER.com ; and to set the site environment: Code: fastcgi_param SITE_ENVIRONMENT development;
(06-10-2015, 03:31 PM)CroNiX Wrote: Codeigniter has nothing to do with the server it's being run on. The server, whether it's Apache, NGINX, LightHTTP, IIS or something else it needs to be set up to run the PHP application, whether it's CI or WordPress or something else. The application can't alter to webserver to "make itself run". No webserver runs PHP by default, except maybe PHP's built-in webserver. This configuration when I should I put it? I have a vps with plesk with more sites installed. Normally it should be inserted in /etc/nginx/nginx.conf, no? I read that in the plesk 12 for nginx.config we can create a vhost_nginx.conf in /var/www/vhosts/system/domain/conf But when I try to insert the file with your configuration Nothing changes. I also tried to restart the nginx. I always give me error 404.
I'm sorry, I don't know anything about how plesk operates or where it puts files.
Mine's in: /etc/nginx/conf.d/www.mysitename.com.conf
When I try to set vhost_nginx.conf I receve this error:
Code: /usr/local/psa/admin/bin/nginxmng --enable
I added http { before server { because it gave me the same error but with the server. So read on the internet I saw that putting http { before some had resolved. But it is not for me.
If I edit the additional nginx declaration with this: PHP Code: ## These locations would be hidden by .htaccess normally I receive a 502 bad gateway on routes. I edit the file in this way: Code: proxy_buffer_size 128k; and in this moment I have 404 page not found. EDIT: I stop, I do not know what to do and groped. I look for someone who can help you Site is not in any controller. Only the main one. I also tried to disable nginx but the result is the 404 page not found. EDIT2: But if the nginx.conf serves essentially to replace the .htaccess. Not everything should work equally? Since I have not used in local .htaccess?
|
Welcome Guest, Not a member yet? Register Sign In |