Konfigurieren Sie Apache, um die Laravel -App neben der regulären App zu bedienenPhp

PHP-Programmierer chatten hier
Anonymous
 Konfigurieren Sie Apache, um die Laravel -App neben der regulären App zu bedienen

Post by Anonymous »

Meine Website wird mit der folgenden virtuellen Hostkonfiguration ausgeführt: < /p>

Code: Select all


DocumentRoot /home/myuser/MyDomain/src
ServerName MyDomain.com
ServerAlias www.MyDomain.com
ErrorLog /home/myuser/logs/apache/MyDomain-error_log
CustomLog /home/myuser/logs/apache/MyDomain-access_log common
DirectoryIndex index.php


Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
AddOutputFilterByType DEFLATE text/html text/plain text/xml


#LogLevel alert rewrite:trace6
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f [OR]

RewriteRule ^/api/media/(.*) /data/$1 [L]
RewriteRule ^/api/v1/* /api/v1/index.php [L]
RewriteRule ^/api/cdn/v1/* /api/cdn/v1/index.php [L]
RewriteRule ^/assets/(.*) /website/v1/content/assets/$1 [L]
RewriteRule ^/css/(.*) /website/v1/content/css/$1 [L]
RewriteRule ^/js/(.*) /website/v1/content/js/$1 [L]
RewriteRule ^/fonts/(.*) /website/v1/content/fonts/$1 [L]
RewriteRule ^/\.well-known/acme-challenge/(.*)$ /.well-known/acme-challenge/$1 [L]
RewriteRule ^/* /website/v1/index.php [L]
#sslstuff


< /code>
Ich migriere zu Laravel und möchte Laravel neben der Live -Website auf /v2 < /code> -Pad bereitstellen. Die Laravel -App befindet sich im Ordner/Website/v2/p2 
, daher habe ich ein weiteres Umschreiben für alle URLs hinzugefügt, die mit/v2 beginnen. Dies ist meine aktuelle Conf -Datei (ich habe nur ein einzelnes Umschreiben hinzugefügt): < /p>

Code: Select all


DocumentRoot /home/myuser/MyDomain/src
ServerName MyDomain.com
ServerAlias www.MyDomain.com
ErrorLog /home/myuser/logs/apache/MyDomain-error_log
CustomLog /home/myuser/logs/apache/MyDomain-access_log common
DirectoryIndex index.php


Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
AddOutputFilterByType DEFLATE text/html text/plain text/xml


#LogLevel alert rewrite:trace6
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f [OR]

RewriteRule ^/v2/(.*) /website/v2/p2/public/index.php [L] # this is new

RewriteRule ^/api/media/(.*) /data/$1 [L]
RewriteRule ^/api/v1/* /api/v1/index.php [L]
RewriteRule ^/api/cdn/v1/* /api/cdn/v1/index.php [L]
RewriteRule ^/assets/(.*) /website/v1/content/assets/$1 [L]
RewriteRule ^/css/(.*) /website/v1/content/css/$1 [L]
RewriteRule ^/js/(.*) /website/v1/content/js/$1 [L]
RewriteRule ^/fonts/(.*) /website/v1/content/fonts/$1 [L]
RewriteRule ^/\.well-known/acme-challenge/(.*)$ /.well-known/acme-challenge/$1 [L]
RewriteRule ^/* /website/v1/index.php [L]
#sslstuff


Besuchen Sie /v2/index.php jetzt funktioniert. Leider gibt besuchen/v2

Code: Select all

Route::get('/newroute', function () {
return "It works, lol";
});
und Besuch gibt auch 404 Fehler zurück.

Code: Select all

init rewrite engine with requested uri /v2
applying pattern '^/v2(/.*)?$' to uri '/v2'
RewriteCond: input='/v2' pattern='!-d' => matched
RewriteCond: input='/v2' pattern='!-f' => matched
rewrite '/v2' -> '/website/v2/p2/public/index.php'
setting lastsub to rule with output /website/v2/p2/public/index.php
local path result: /website/v2/p2/public/index.php
prefixed with document_root to /home/myuser/MyDomain/src/website/v2/p2/public/index.php
go-ahead with /home/myuser/MyDomain/src/website/v2/p2/public/index.php [OK]
Es scheint, dass 404 Ausgabe darauf zurückzuführen ist, wie Laravel verhandelt

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post