Git Product home page Git Product logo

yii2-advanced-one-domain-config's People

Contributors

mickgeek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-advanced-one-domain-config's Issues

Trying to get in touch regarding a security issue

Hey there!

I'd like to report a security issue but cannot find contact instructions on your repository.

If not a hassle, might you kindly add a SECURITY.md file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.

Thank you for your consideration, and I look forward to hearing from you!

(cc @huntr-helper)

change url /admin nginx

Hello,

How to change the path /admin to /backend on NGINX

I tried to change the config

....
location /backend{
        alias  /path/to/advanced/backend/web;
        try_files  $uri /backend/web/index.php?$args;

        # redirect to the page without a trailing slash (uncomment if necessary)
        #location = /admin/ {
        #    return  301 /admin;
        #}

        location ~* ^/backend/(.+\.php)$ {
            try_files  $uri /backend/web/$1?$args;
        }

        # avoid processing of calls to non-existing static files by Yii (uncomment if necessary)
        #location ~* ^/admin/(.+\.(css|js|jpg|jpeg|png|gif|bmp|ico|mov|swf|pdf|zip|rar))$ {
        #    try_files  $uri /backend/web/$1?$args;
        #}
}
...

It displays 404 error

Why don't use Alias in Apache?

Alias is simpler and quicker.
http://httpd.apache.org/docs/2.4/rewrite/avoid.html#alias
It mange, also, the tedious trailing slash problem.
The resulting configuration is cleaner.
So, why not?

A configuration example below.

Regards,
HUjuice

# Frontend
# ==============================
DocumentRoot /path/to/yii2-advanced/frontend/web
<Directory /path/to/yii2-advanced/frontend/web>
    Options -Indexes +FollowSymLinks
    AllowOverride None
    Require all granted

    # Use mod_rewrite for pretty URL support
    RewriteEngine On
    # If a directory or a file exists, use the request directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # Otherwise forward the request to index.php
    RewriteRule . index.php
</Directory>

# Backend
# ==============================
Alias /backend /path/to/yii2-advanced/backend/web
<Directory /path/to/yii2-advanced/backend/web>
    Options -Indexes +FollowSymLinks
    AllowOverride None
    Require all granted

    # Use mod_rewrite for pretty URL support
    RewriteEngine On
    # If a directory or a file exists, use the request directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # Otherwise forward the request to index.php
    RewriteRule . index.php
</Directory>

Nginx config

I use nginx config as it is, /admin location works fine, fronted with page url also,
but home location / (http://advanced.local) gives 404 error! I check in that case no index.php is used6 this is nginx 404 error.
How to fix it?

No longer fully working since nginx 1.8.1

I use the vhosts/nginx.conf file, since upgrading nginx from 1.8.0 to 1.8.1 the page /admin downloads the index.php file and does not process it as php any more. Requests to subpages as /admin/test work as expected.

The changelog lists the following relevant change:

    *) Bugfix: the "try_files" directive inside a nested location given by a
       regular expression worked incorrectly if the "alias" directive was
       used in the outer location.

If you have 500 internal error after change .htaccess

As it turned out, not all virtual hosting services support
--Options FollowSymLinks--
Removing this line from .htaccess helped me solve the problem with 500 internal error.
I'll just leave it here. Because this guy's url solution is the best on the whole internet.

Used your settings htaccess etc but not working :(

See title

If I run php yii serve --port=8890, i can see login page without js and css assets,
if i run php yii serve --docroot="frontend/web/" --port=8890 frontend stuffs working good but /admin i get 404

i dont understand and i tried to put frontend and backend .htaccess but nothing....

I use xampp in windows, pls help meeee

adding a new URI

First of all thanks for the good work.

I have used your project to isolate my frontend and backend and works great.

my question is what if i need to add a third one with /api that means

localhost - for frontend
localhost/admin for backend
localhost/api for api endpoints

I tried on my own using the /admin as a template but it is not working for me. would be great if you could add this feature in your project.

thanks and regards,

phpMyAdmin

I use vhosts/apache.conf
and now link
'localhost/phpmyadmin' - not found 404

Add configuration for IIS

Hi! I think configuration for IIS (web.config) would be a good addition to this project and useful.

All links of the site always loads the home page.

Hi mickgeek,

I found your code useful and I am trying to achieve Advanced app project into my hostgator business cloud (shared) account.

for backend I have successfully configured the sub domain however for frontend the hostgator says that I am unable to set this up so I had put the below htaccess rule in public_html direcory.

`Options FollowSymLinks
AddDefaultCharset utf-8

RewriteEngine On
# if a directory or a file of the frontend application exists, use the request directly
RewriteCond %{REQUEST_URI} ^/frontend/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward the request to index.php
RewriteRule . /frontend/web/index.php [L]

# the main rewrite rule for the frontend application
RewriteCond %{REQUEST_URI} !^/(backend/web|admin)
RewriteRule !^frontend/web /frontend/web%{REQUEST_URI} [L]


RewriteCond %{REQUEST_URI} \.(htaccess|htpasswd|svn|git)
RewriteRule \.(htaccess|htpasswd|svn|git) - [F]
`

after saving the file it loads the home page successfully but whatever link I click it always keeps opening home page, here is the link: http://cliknpost.com/ visit other links and it will always show the home page content.

Below is my UrlManager configuration.
'enablePrettyUrl' => true, 'showScriptName' => false,

Your help is much appreciated thanks.

add one line in /etc/hosts file for work all...

Hi, thanks for great repo/solution :) but on my ubuntu localhost it won't work, 404 return me...

Change this VirtualHost *:80 ... to VirtualHost myApp:80

...to make it all work, locally, it would seem that it serves to add this line in /etc/hosts file:

127.0.0.1 myApp

Internal server error 500 after making changes

HI,
I am getting error 500 as below after changing the files as per your instructions. any help is appreciated.
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

server log:

d 4024:tid 1012] [client ::1:61355] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Mon Aug 31 00:12:55.626711 2015] [core:debug] [pid 4024:tid 1012] core.c(3590): [client ::1:61355] AH00121: r->uri = /index.php
[Mon Aug 31 00:12:55.626711 2015] [core:debug] [pid 4024:tid 1012] core.c(3596): [client ::1:61355] AH00122: redirected from r->uri = /index.php
[Mon Aug 31 00:12:55.626711 2015] [core:debug] [pid 4024:tid 1012] core.c(3596): [client ::1:61355] AH00122: redirected from r->uri = /index.php
[Mon Aug 31 00:12:55.626711 2015] [core:debug] [pid 4024:tid 1012] core.c(3596): [client ::1:61355] AH00122: redirected from r->uri = /index.php
[Mon Aug 31 00:12:55.626711 2015] [core:debug] [pid 4024:tid 1012] core.c(3596): [client ::1:61355] AH00122: redirected from r->uri = /index.php
[Mon Aug 31 00:12:55.626711 2015] [core:debug] [pid 4024:tid 1012] core.c(3596): [client ::1:61355] AH00122: redirected from r->uri = /index.php
[Mon Aug 31 00:12:55.626711 2015] [core:debug] [pid 4024:tid 1012] core.c(3596): [client ::1:61355] AH00122: redirected from r->uri = /index.php
[Mon Aug 31 00:12:55.626711 2015] [core:debug] [pid 4024:tid 1012] core.c(3596): [client ::1:61355] AH00122: redirected from r->uri = /index.php
[Mon Aug 31 00:12:55.626711 2015] [core:debug] [pid 4024:tid 1012] core.c(3596): [client ::1:61355] AH00122: redirected from r->uri = /index.php
[Mon Aug 31 00:12:55.626711 2015] [core:debug] [pid 4024:tid 1012] core.c(3596): [client ::1:61355] AH00122: redirected from r->uri = /index.php
[Mon Aug 31 00:12:55.626711 2015] [core:debug] [pid 4024:tid 1012] core.c(3596): [client ::1:61355] AH00122: redirected from r->uri = /
[Mon Aug 31 00:15:27.882400 2015] [mpm_winnt:notice] [pid 8140:tid 612] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Mon Aug 31 00:15:27.882400 2015] [mpm_winnt:debug] [pid 4024:tid 508] child.c(1158): AH00357: Child: Exit event signaled. Child process is ending.
[Mon Aug 31 00:15:27.882400 2015] [mpm_winnt:debug] [pid 4024:tid 1036] child.c(735): AH00348: Child: Accept thread exiting.
[Mon Aug 31 00:15:27.882400 2015] [mpm_winnt:debug] [pid 4024:tid 1040] child.c(735): AH00348: Child: Accept thread exiting.
[Mon Aug 31 00:15:28.883461 2015] [mpm_winnt:debug] [pid 4024:tid 508] child.c(1215): AH00359: Child: Released the start mutex
[Mon Aug 31 00:15:28.883461 2015] [mpm_winnt:debug] [pid 4024:tid 508] child.c(1227): AH00361: Child: 64 threads blocked on the completion port
[Mon Aug 31 00:15:29.884642 2015] [mpm_winnt:notice] [pid 4024:tid 508] AH00364: Child: All worker threads have exited.
[Mon Aug 31 00:15:29.888623 2015] [mpm_winnt:debug] [pid 4024:tid 508] mpm_winnt.c(1713): AH00454: Child process is exiting
[Mon Aug 31 00:15:29.920089 2015] [mpm_winnt:notice] [pid 8140:tid 612] AH00430: Parent: Child process 4024 exited successfully.
[Mon Aug 31 00:15:29.921090 2015] [core:info] [pid 8140:tid 612] AH00096: removed PID file C:/Apache24/logs/httpd.pid (pid=8140)
Starting the 'Apache2.4' service
The 'Apache2.4' service is running.

Combine redirect https rule

I have a redirect to https rule something like:
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

How to combine this rule into your .htaccess file without facing the error "redirected too many times"?

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.