T
T
Tat622020-01-03 15:26:24
Yii
Tat62, 2020-01-03 15:26:24

How to set up yii2 in iis8?

IIS8 is on a virtual machine. It has a public ip address . It is necessary that my site written in yii2 advanced opens at this address. Therefore, I moved the project to the c:\inetpub\wwwroot\my project folder from the c:\domain\ myproject\ folder . In manager IIS8, I registered a new path to the folder c:\inetpub\wwwroot\my project\frontend\web . There is a web.config file :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
        <httpRedirect enabled="false" destination="" childOnly="true" httpResponseStatus="Permanent" />
        <rewrite>
            <rules>
    <rule name="Hide Yii Index" enabled="true" stopProcessing="true">
     <match url="^(.*)\?*$" ignoreCase="false" />
       <conditions>
         <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
 		     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
       </conditions>
     <action type="Rewrite" url="/index.php/{R:1}" appendQueryString="true" />
     </rule>
            </rules>
        </rewrite>
</system.webServer>
</configuration>

At the old address c:\domain\my project\frontend\web in the virtual machine browser, the site opened and it was possible to walk through the pages. But at the new address c:\inetpub\wwwroot\my project\frontend\web , only the main page opens, because it has a full path. If you run the site from a computer, the rest of the pages are not found (404 error, paths are formed incorrectly). If you run the site from a virtual machine, you get database communication errors. Probably because the phpmyadmin folder is located at c:\inetpub\wwwroot\admin . It turns out web.config doesn't work . As I understand it, you need to create an index.php file in the c:\inetpub\wwwroot\my project\ folder. But I can't figure out what to write in it. Maybe you need to do something else. Commands composer: install, init executed. Url rewrite reinstalled. I have 2 questions:
what needs to be done, set up:
1. so that you can walk through all the pages;
2. so that in the browser of any computer, when entering a public ip-address, my site opens.
If someone knows something about at least one of the questions, tell me, please. I really hope for help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2020-01-04
@Tat62

If your virtual machine is running over a network, then use the machine's address in the ip address bar instead of 127.0.0.1 and localhost. Read about it. Set up the hosts yourself. Your project should be available at: http://10.12.155.34/project
Next, configure your web server so that it sends all requests to http://10.12.155.34/projectfrontend/web/index.php
The question is not entirely related to yii, it's more about setting up a server and working over the network.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question