You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[documentation] Can anyone help with nginx rewrites? #55
Hey, just for your info: This script uses the most used htaccess in the world, the typical "beautiful URLs" rewrite rules. No weird stuff, no stunts. I even think Wordpress etc. use exactly the same.
Btw maybe Nginx is not what you should use if this brings you in trouble.
can you post more info / error logs ? Btw I noticed that you are using a custom folder structure. The php-mvc is build for usage in webroot or in a simple subfolder, so your use case might be special. The php-mvc is btw made for beginners, I think you're quite professional, maybe you don't need he php-mvc. :)
I think this ticket is overcomplicating things. The php-mvc is very basic and uses the most standard rewrite rules, and there's no need to install this in nginx in a multi-folder deep nesting structure usually. Running this from two-levels deep subfolders if definitly totally out of the scope of this script, so let's close the ticket.
Okay this is a often requested feature, let's create a guideline / native integration for this project! Thanks for the comments so far, good stuff in here!
Hello. I am also having a problem getting this to work on nginx (and switching to Apache is not a realistic option.) I have cloned the repository to /var/www/php-mvc/
I have made the following changes. 1)modified this line of config.php:
define('URL', 'http://XXX.XXX.XXX.XXX/php-mvc/');
where the URL is the ip address of my test DO server.
2) made the change digitaltoast recommended to /etc/nginx/nginx.conf
3) made change digitaltoast recommended to /etc/nginx/sites-available/default
4) restarted the server
when I go to http://XXX.XXX.XXX.XXX/php-mvc/ the homepage shows up perfectly. But, when I click on the links I get a message saying "file not found."
I changed application.php line 74 to trim, I changed my nginx.conf back to the original. I have this in my /etc/nginx/sites-available/default file:
location / {
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?url=$uri;
}
I believe I'm modifying the correct file (/etc/nginx/sites-available/default). If not let me know.
If it's no trouble, I wouldn't mind looking at your nginx.config file. Thanks!
I'm not sure if there is a way to get it working my original way, as I have other projects in /var/www/ that I'd want to work on simultaneously. Perhaps this is bad practice, though?
I just made php-mvc work on Mac OS X 10.10 Beta 4 with NGINX 1.6.0, PHP 5.5.14, PEAR 1.9.5 and MySQL 5.6.16.
I followed @digitaltoast instructions. Only difference is that I have my sites separated from the main nginx.conf file inside the sites-available folder.
Here is my /sites-available/phpmvc.com configuration file:
Cool stuff guys! I'll implement this right into the project in September or October (when there's time!). Good to see that the project is useful for you all :)
I've just released MINI (=php-mvc) in a new version with a different structure (index.php is now in /public, plus diffrenent .htaccess). Would be nice if you could test this and post a working nginx config for this.
Activity
panique commentedon Feb 27, 2014
Hey, just for your info: This script uses the most used htaccess in the world, the typical "beautiful URLs" rewrite rules. No weird stuff, no stunts. I even think Wordpress etc. use exactly the same.
Btw maybe Nginx is not what you should use if this brings you in trouble.
panique commentedon Feb 27, 2014
He again,
can you post more info / error logs ? Btw I noticed that you are using a custom folder structure. The php-mvc is build for usage in webroot or in a simple subfolder, so your use case might be special. The php-mvc is btw made for beginners, I think you're quite professional, maybe you don't need he php-mvc. :)
panique commentedon Mar 7, 2014
I think this ticket is overcomplicating things. The php-mvc is very basic and uses the most standard rewrite rules, and there's no need to install this in nginx in a multi-folder deep nesting structure usually. Running this from two-levels deep subfolders if definitly totally out of the scope of this script, so let's close the ticket.
panique commentedon Apr 21, 2014
Okay this is a often requested feature, let's create a guideline / native integration for this project! Thanks for the comments so far, good stuff in here!
stevehmig commentedon Jul 2, 2014
Hello. I am also having a problem getting this to work on nginx (and switching to Apache is not a realistic option.) I have cloned the repository to /var/www/php-mvc/
I have made the following changes. 1)modified this line of config.php:
define('URL', 'http://XXX.XXX.XXX.XXX/php-mvc/');
where the URL is the ip address of my test DO server.
2) made the change digitaltoast recommended to /etc/nginx/nginx.conf
3) made change digitaltoast recommended to /etc/nginx/sites-available/default
4) restarted the server
when I go to http://XXX.XXX.XXX.XXX/php-mvc/ the homepage shows up perfectly. But, when I click on the links I get a message saying "file not found."
I'm not sure how to troubleshoot this.
stevehmig commentedon Jul 2, 2014
I changed application.php line 74 to trim, I changed my nginx.conf back to the original. I have this in my /etc/nginx/sites-available/default file:
location / {
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?url=$uri;
}
I believe I'm modifying the correct file (/etc/nginx/sites-available/default). If not let me know.
If it's no trouble, I wouldn't mind looking at your nginx.config file. Thanks!
stevehmig commentedon Jul 2, 2014
Thanks, I got it working!
I changed root /var/www; to:
root /var/www/php-mvc;
and in config.php changed:
define('URL', 'http://XXX.XXX.XXX.XXX/php-mvc/');
to:
define('URL', 'http://XXX.XXX.XXX.XXX/');
I'm not sure if there is a way to get it working my original way, as I have other projects in /var/www/ that I'd want to work on simultaneously. Perhaps this is bad practice, though?
Thanks again @digitaltoast
RacZo commentedon Aug 2, 2014
Awesome stuff!
I just made php-mvc work on Mac OS X 10.10 Beta 4 with NGINX 1.6.0, PHP 5.5.14, PEAR 1.9.5 and MySQL 5.6.16.
I followed @digitaltoast instructions. Only difference is that I have my sites separated from the main nginx.conf file inside the sites-available folder.
Here is my /sites-available/phpmvc.com configuration file:
Added "127.0.0.1 phpmvc.com" to my /etc/hosts file.
panique commentedon Aug 2, 2014
Cool stuff guys! I'll implement this right into the project in September or October (when there's time!). Good to see that the project is useful for you all :)
panique commentedon Oct 14, 2014
FYI: #59 has been just merged into develop branch.
[-]Can anyone help with nginx rewrites?[/-][+][documentation] Can anyone help with nginx rewrites?[/+]panique commentedon Nov 8, 2014
Heyyyy people,
I've just released MINI (=php-mvc) in a new version with a different structure (index.php is now in /public, plus diffrenent .htaccess). Would be nice if you could test this and post a working nginx config for this.
Big thanks!
Add example nginx config to README
panique commentedon Feb 28, 2015
Good news: There's now a nginx config right in the README :)