Code Monkey home page Code Monkey logo

Comments (13)

 avatar commented on August 19, 2024 3

Nice - got it working. Problem yesterday was the # enforce NO www as I already do this before (and that I was short on time ;) ). Shortly - if you already rewrite www to non-www just use this in your server section:

	location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
		access_log off;
		expires max;
		log_not_found off;
	}

	# removes trailing slashes (prevents SEO duplicate content issues)
	if (!-d $request_filename)
	{
		rewrite ^/(.+)/$ /$1 permanent;
	}

	# unless the request is for a valid file (image, js, css, etc.), send to bootstrap
	if (!-e $request_filename)
	{
		rewrite ^/(.*)$ /index.php?/$1 last;
		break;
	}

	location / {
		try_files $uri $uri/ /index.php?$query_string;
	}

... and optionally get rid of the .htaccess in public folder.

Thanks for the support!

from lychee.

ildyria avatar ildyria commented on August 19, 2024

No, it is totally normal that there is no php folder or php/index.php file.
This is taken care of by the routes in Laravel. Cf in routes/web.php:

Route::post('/php/index.php',                   'SessionController@init'); // entry point if options are not initialized

To solve this, from https://www.digitalocean.com/community/tutorials/how-to-deploy-a-laravel-application-with-nginx-on-ubuntu-16-04 They just do :

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

However this approach might be better: https://gist.github.com/ashleydw/afd389b1e763d3c1cf1f
The part that is of interest for you:

    # serve static files directly
	location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
		access_log off;
		expires max;
		log_not_found off;
	}

	# removes trailing slashes (prevents SEO duplicate content issues)
	if (!-d $request_filename)
	{
		rewrite ^/(.+)/$ /$1 permanent;
	}

	# enforce NO www
	if ($host ~* ^www\.(.*))
	{
		set $host_without_www $1;
		rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
	}

	# unless the request is for a valid file (image, js, css, etc.), send to bootstrap
	if (!-e $request_filename)
	{
		rewrite ^/(.*)$ /index.php?/$1 last;
		break;
	}

	location / {
		try_files $uri $uri/ /index.php?$query_string;
	}

If you get something to work please do tell us as we don't use nginx and that would be useful for other users.

from lychee.

 avatar commented on August 19, 2024

Thanks for your proposals. Just gave it a quick try but neither of the two proposals seem to work (first solution made no difference, second gave me a 502 Bad Gateway). I will take a look at how to integrate laravel in the nginx environment and have some experiments tomorrow and let you know my progress.

from lychee.

ildyria avatar ildyria commented on August 19, 2024

The 502 Bad Gateway is actually a good news! It means that the problem is not with the rewrite anymore but with the server parameters.

from lychee.

ildyria avatar ildyria commented on August 19, 2024

@Hagenzone Can you write a page in the Wiki to descripe how to install Lychee-Laravel on nginx ? :)

from lychee.

 avatar commented on August 19, 2024

Sure. Could you grant me access?

from lychee.

ildyria avatar ildyria commented on August 19, 2024

@Hagenzone sorry, I though you already had access. Fixed. :)

from lychee.

 avatar commented on August 19, 2024

Does this take a while to apply? Still can't push :(

from lychee.

ildyria avatar ildyria commented on August 19, 2024

That is surprising because I untick the box as required:

  • Restrict editing to users in teams with push access only
    Public wikis will still be readable by everyone.

from lychee.

 avatar commented on August 19, 2024

Tried to edit wiki page locally and push. Resulted in 403. Updated the page via github GUI now.

from lychee.

ildyria avatar ildyria commented on August 19, 2024

@Hagenzone I saw your edit. It's perfect. Can we close this issue ? :)

from lychee.

 avatar commented on August 19, 2024

Sure, thanks again!

from lychee.

d7415 avatar d7415 commented on August 19, 2024

Tried to edit wiki page locally and push. Resulted in 403. Updated the page via github GUI now.

If you got the URL while you didn't have access it would have defaulted to anonymous https. That may have been the issue here.

Thanks for the work. That'll come in really useful for me very shortly!

from lychee.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.