Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The requested URL was not found on this server. #4

Closed
theodotos opened this issue May 22, 2018 · 9 comments
Closed

The requested URL was not found on this server. #4

theodotos opened this issue May 22, 2018 · 9 comments

Comments

@theodotos
Copy link

I had some progress on setting the system. Now I can see the frontpage but I get 404 errors on all the links I visit:

The requested URL /users/login was not found on this server.
Apache/2.4.29 (Ubuntu) Server at humanecosystems.example.com Port 443

The requested URL /home/visualize was not found on this server.
Apache/2.4.29 (Ubuntu) Server at humanecosystems.example.com Port 443

The requested URL /users/add was not found on this server.
Apache/2.4.29 (Ubuntu) Server at humanecosystems.example.com Port 443

I have these modules enabled:

access_compat
authn_core
authz_host
deflate
filter
negotiation
rewrite
ssl
alias
authn_file
authz_user
dir
mime
php7.0
setenvif
status
auth_basic
authz_core
autoindex
env
mpm_prefork
reqtimeout
socache_shmcb

My Apache vhost:

<VirtualHost *:80>
    ServerName  humanecosystems.example.com

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

</VirtualHost>

<VirtualHost *:443>
    ServerName  humanecosystems.example.com
    DocumentRoot /var/www/html/humanecosystems.example.com/webroot

    SSLEngine on

    SSLCertificateFile    /etc/apache2/ssl/humanecosystems.example.com.pem
    SSLCertificateKeyFile /etc/apache2/ssl/humanecosystems.example.com.key

    SSLProtocol             all -SSLv2 -SSLv3
    SSLCipherSuite          ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
    SSLHonorCipherOrder     on
    SSLCompression          off

    SSLOptions +StrictRequire

    # Add vhost name to log entries:
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined
    LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common
</VirtualHost>

Any idea?

@xdxdVSxdxd
Copy link
Owner

hi! sorry for not answering sooner: I was traveling :)

did you manage to solve the problem?

It could be the .htaccess file in the web folder
can you show it?

@theodotos
Copy link
Author

theodotos commented May 30, 2018

Hi!

did you manage to solve the problem?

No, not yet. Here's how .htaccess looks like:

Outside webroot:

root@humanecosystems:~# cat /var/www/html/humanecosystems.example.com/.htaccess 
<IfModule mod_rewrite.c>
    RewriteEngine on
RewriteBase /HEv3/
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

Inside .webroot:

root@humanecosystems:~# cat /var/www/html/humanecosystems.example.com/webroot/.htaccess 
<IfModule mod_rewrite.c>
    RewriteEngine On
RewriteBase /HEv3/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

@xdxdVSxdxd
Copy link
Owner

oh, I see the problem: you have

RewriteBase /HEv3/

which is used as the base of your URLs

but from what I see in your setup it is not this, right?

for example, you do not have the system accessible through something like:

http://humanecosystems.example.com/**HEv3**

you should put in RewriteBase the part of the URL that matches the root directory from which you can access the system from the http server. If it is in the root directory of the http server, then you can just put a slash /

try it out and let me know

@theodotos
Copy link
Author

It worked! \o/

My Apache VirtualHost configuration:

<VirtualHost *:80>
    ServerName  humanecosystems.cut.ac.cy

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]

</VirtualHost>

<VirtualHost *:443>
    ServerName  humanecosystems.example.com
    DocumentRoot /var/www/html/humanecosystems.example.com/

    SSLEngine on

    SSLCertificateFile    /etc/apache2/ssl/humanecosystems.cut.ac.cy.pem
    SSLCertificateKeyFile /etc/apache2/ssl/humanecosystems.cut.ac.cy.key

    SSLProtocol             all -SSLv2 -SSLv3
    SSLCipherSuite          ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
    SSLHonorCipherOrder     on
    SSLCompression          off

    SSLOptions +StrictRequire

    # Add vhost name to log entries:
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined
    LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common

    <Directory /var/www/html/humanecosystems.example.com/>
        AllowOverride All
    </Directory>

</VirtualHost>

The AllowOverride All above is very important for .htaccess to work.

My .htaccess files:

Docroot:

root@humanecosystems:~# cat /var/www/html/humanecosystems.example.com/.htaccess 
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

Webroot:

# cat /var/www/html/humanecosystems.example.com/webroot/.htaccess
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Thanks @xdxdVSxdxd

@mykoman
Copy link

mykoman commented Jul 27, 2018

I am using my application was built using laravel and I am having a similar situation, my htaccess looks different from the one above. Here is mine. Can you kindly help me out. I don't know much about htaccess please. My website is www.stash.com.ng the page loads fine but every other page doesn't go through. It was hosted on digital ocean and Ubuntu 18.04 was used.
`

Options -MultiViews -Indexes

RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
` I hope to get a response soon. Thanks in advance

@slavos
Copy link

slavos commented Dec 5, 2018

If you are running on Ubuntu try
sudo a2enmod rewrite
then restart apache2

@juliarnasution
Copy link

If you are running on Ubuntu try
sudo a2enmod rewrite
then restart apache2

thanks it work's

@Logik03
Copy link

Logik03 commented May 7, 2020

I am using my application was built using laravel and I am having a similar situation, my htaccess looks different from the one above. Here is mine. Can you kindly help me out. I don't know much about htaccess please. My website is www.stash.com.ng the page loads fine but every other page doesn't go through. It was hosted on digital ocean and Ubuntu 18.04 was used.
`

Options -MultiViews -Indexes

RewriteEngine On

Handle Authorization Header

RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

` I hope to get a response soon. Thanks in advance

firstly

sudo nano /etc/apache2/apache.conf

secondly

Inside apache2.conf change
<Directory /var/www/your_domain>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted

To
<Directory /var/www/your_domain>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted

@Vikashdhruv70
Copy link

I am trying to deploy my application was built using laravel but whenever i trying with ip it is showing this.
Screenshot (212)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants