Answers.Body: <p>You're close.</p>
  <p>The <code>DocumentRoot</code> is where in the filesystem Apache will &quot;start&quot; serving files for that virtual host (server name). Basically it's where the &quot;home page&quot; of the server lives.</p>
  <p>So if <code>localhost</code> is the name of the vhost, your &quot;home page&quot; would be at <code>http://localhost</code> and you can get to the admin/dashboard of the site at <code>http://localhost/admin/login</code>.</p>
  <p>If for some reason your rewrites aren't working, you can still access the dashboard of the site like <code>http://localhost/index.php?p=admin/login</code>.</p>
  <p>The <code>testsite/web</code> isn't part of the URL because that's where in the filesystem Apache will &quot;start&quot; looking but it is part of the <code>DocumentRoot</code>. Basically anything below the root is in the URL and anything above is not accessible.</p>
  <p>In your <code>.env</code> file, set your <code>PRIMARY_SITE_URL</code> to <code>http://localhost</code>.</p>
  <p>Also see the <a href="https://craftcms.com/docs/3.x/installation.html" rel="nofollow noreferrer">installation docs</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T15:50:13.053Z
Answers.Text: Thanks for this, so I think my rewrites are currently not working because using http://localhost/index.php?p=admin/login I was able to get to the login form, but after logging in I get taken to http://127.0.0.1/admin/dashboard which again displays a "Not Found" error (and I have enabled mod_rewrite).
Answers.UserDisplayName: BrokenCode
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T15:51:14.017Z
Answers.Text: Make sure you're accessing the site via "localhost" and not the IP Address?
Answers.UserDisplayName: RitterKnight
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T15:56:52.110Z
Answers.Text: Same behavior with "localhost"
Answers.UserDisplayName: BrokenCode
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T16:02:32.670Z
Answers.Text: Hmm I may be missing the overwrite directive in the virtual host, let me test that.
Answers.UserDisplayName: BrokenCode
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T16:04:28.933Z
Answers.Text: That was it, since I used the default apache 000-default.conf file it was missing the directory specific directives. Working now. Thansk!
Answers.UserDisplayName: BrokenCode
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T16:42:15.907Z
Answers.Text: @BrokenCode excellent!
Answers.UserDisplayName: RitterKnight
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T15:29:50.260Z
Answers.LastActivityDate: 2022-01-24T15:46:19.483Z
Answers.LastEditDate: 2022-01-24T15:46:19.483Z
Answers.UserDisplayName: RitterKnight
Answers.Body: <p>First you need to enable mod_rewrite in your ubuntu system.</p>
  <p>Create new .htaccess file in the root location of your project.</p>
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  
  RewriteCond %{REQUEST_FILENAME} -d [OR]
  RewriteCond %{REQUEST_FILENAME} -f
  RewriteRule ^ ^$1 [N]
  
  RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
  RewriteRule ^(.*)$ web/$1
  
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php
  &lt;/IfModule&gt;
  </code></pre>
  <p>After this you can see your admin at this location
  http://localhost/testsite/admin/login</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T14:31:35.943Z
Answers.Text: Thanks for the suggestion. When you say "root location" do you mean the /web folder of craft cms? Also, since I modified apache DocumentRoot to point to /var/www/html/testsite/web do I still need to point the browser to http://localhost/testsite/web/admin/login? I would expect that I don't need to do that?
Answers.UserDisplayName: BrokenCode
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-25T15:13:12.543Z
Answers.Text: Not inside web folder you need to create outside of the web folder
Answers.UserDisplayName: Amandeep Singh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T14:08:37.673Z
Answers.LastActivityDate: 2022-01-25T15:14:51.623Z
Answers.LastEditDate: 2022-01-25T15:14:51.623Z
Answers.UserDisplayName: Amandeep Singh
Body: <p>I'm completely new to Craft CMS, I come from the Drupal/Wordpress corner.</p>
  <p>On my Ubuntu 20.04 LTS with PHP, MySQL, Apache and Composer installed.</p>
  <p>Using Composer I installed craftcms to <code>/var/www/html/testsite/</code></p>
  <p>In <code>/etc/apache2/sites-available/000-default.conf</code> I changed the DocumentRoot to point to <code>/var/www/html/testsite/web</code></p>
  <p>In the browser I point to <code>127.0.0.1</code> and I get the Welcome page.</p>
  <p>When I click on <strong>Go to your control panel</strong> I am taken to <code>127.0.0.1/admin</code> with the following error:</p>
  <blockquote>
  <p>Not Found The requested URL was not found on this server.</p>
  </blockquote>
  <p>In my <code>/var/www/html/testsite/.env</code> file I have <code>PRIMARY_SITE_URL=http://localhost/testsite/web/</code></p>
  <p>What am I missing? (I have looked at other similar questions here but did not find anything helpful for my specific case).</p>
  
Tags: <admin><install>
Title: Craft CMS on LAMP (Ubuntu 20.04 LTS) /admin not loading
ThreadText: # Craft CMS on LAMP (Ubuntu 20.04 LTS) /admin not loading
  
  (Asked by: username_0 on 2022-01-24)
  
  I'm completely new to Craft CMS, I come from the Drupal/Wordpress corner.
  
  On my Ubuntu 20.04 LTS with PHP, MySQL, Apache and Composer installed.
  
  Using Composer I installed craftcms to `/var/www/html/testsite/`
  
  In `/etc/apache2/sites-available/000-default.conf` I changed the DocumentRoot to point to `/var/www/html/testsite/web`
  
  In the browser I point to `127.0.0.1` and I get the Welcome page.
  
  When I click on **Go to your control panel** I am taken to `127.0.0.1/admin` with the following error:
  
  > Not Found The requested URL was not found on this server.
  
  In my `/var/www/html/testsite/.env` file I have `PRIMARY_SITE_URL=http://localhost/testsite/web/`
  
  What am I missing? (I have looked at other similar questions here but did not find anything helpful for my specific case).
  
  **Tags:** admin, install
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-01-24. Score: 2 | Accepted answer
  
  You're close.
  
  The `DocumentRoot` is where in the filesystem Apache will "start" serving files for that virtual host (server name). Basically it's where the "home page" of the server lives.
  
  So if `localhost` is the name of the vhost, your "home page" would be at `http://localhost` and you can get to the admin/dashboard of the site at `http://localhost/admin/login`.
  
  If for some reason your rewrites aren't working, you can still access the dashboard of the site like `http://localhost/index.php?p=admin/login`.
  
  The `testsite/web` isn't part of the URL because that's where in the filesystem Apache will "start" looking but it is part of the `DocumentRoot`. Basically anything below the root is in the URL and anything above is not accessible.
  
  In your `.env` file, set your `PRIMARY_SITE_URL` to `http://localhost`.
  
  Also see the [installation docs](https://craftcms.com/docs/3.x/installation.html).
  
  > **Comments:**
  > **username_0**: Thanks for this, so I think my rewrites are currently not working because using http://localhost/index.php?p=admin/login I was able to get to the login form, but after logging in I get taken to http://127.0.0.1/admin/dashboard which again displays a "Not Found" error (and I have enabled mod_rewrite).  
  > **username_1**: Make sure you're accessing the site via "localhost" and not the IP Address?  
  > **username_0**: Same behavior with "localhost"  
  > **username_0**: Hmm I may be missing the overwrite directive in the virtual host, let me test that.  
  > **username_0**: That was it, since I used the default apache 000-default.conf file it was missing the directory specific directives. Working now. Thansk!  
  > **username_1**: @username_0 excellent!  
  
  ---
  
  ### Answer by username_2 on 2022-01-24. Score: 1
  
  First you need to enable mod\_rewrite in your ubuntu system.
  
  Create new .htaccess file in the root location of your project.
  
  ```
  <IfModule mod_rewrite.c>
  RewriteEngine On
  
  RewriteCond %{REQUEST_FILENAME} -d [OR]
  RewriteCond %{REQUEST_FILENAME} -f
  RewriteRule ^ ^$1 [N]
  
  RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
  RewriteRule ^(.*)$ web/$1
  
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php
  </IfModule>
  
  ```
  
  After this you can see your admin at this location
  http://localhost/testsite/admin/login
  
  > **Comments:**
  > **username_0**: Thanks for the suggestion. When you say "root location" do you mean the /web folder of craft cms? Also, since I modified apache DocumentRoot to point to /var/www/html/testsite/web do I still need to point the browser to http://localhost/testsite/web/admin/login? I would expect that I don't need to do that?  
  > **username_2**: Not inside web folder you need to create outside of the web folder  
  
  ---
  
  