Back

Laravel returns “No input file specified.” after vhost edit


I recently installed a fresh copy of Laravel onto this test domain -http://laravel.so-mad.com/ using composer. Install worked fine, if i navigated to http://laravel.so-mad.com/laravel/public then it all worked as it should.

I then began the task of editing to DocumentRoot on my server. editing the httpd.conf file directly wasn't an option as this gets automatically rebuilt whenever there is an update or the server is rebooted.

However, there is a file included if the file exists at

/etc/apache2/conf.d/userdata/std/2_4/somad/laravel.so-mad.com/*.conf

I editied this file adding in the line

DocumentRoot /home/somad/public_html/nobackup/laravel/laravel/public

This.. I thought would allow my new laravel project to work from the domain root without having to navigate to /laravel/public.

However, as you can see by navigating to http://laravel.so-mad.com/ i just get the message

No input file specified.

I have since removed the DocumentRoot changes and it worked as it did before. I then re-added the changes as i need to get it working at the root of the domain. (I assume this is the correct way to do this)

Whilst the DocumentRoot edits are in place if i change the larvel folder to laravell temporarily then I get 404 which is expected. This is why i think its all a Laravel configuration issue somewhere.

Any advice or help would be much appreciated

Taftse replied 1 week ago

Hi Josh,

You don't list who your host is or what server operating system your running. but to me it sounds like you are looking for name based virtual hosts please check out [this link] (https://www.linode.com/docs/websites/hosting-a-website-ubuntu-18-04/#configure-name-based-virtual-hosts) that shows how to set them up on ubuntu but should work on most installs

Regards

Timothy

Josh Burley replied 1 week ago

Hi Timothy,

Its running on CentOs 6 and is my own dedicated system. I'm unsure about using the method described above as the server has a lot of my clients on there. This was just going to be a training exercise for myself to learn as a potential new client is using Laravel. I didn't think it would be a pain just to get the public folder be the root of the domain. What i have done should have worked logically.

Any ideas on how to fix my issue rather than trying a slightly different, but in the end same idea.

Thanks in advance

Taftse replied 1 week ago

If its a dedicated server hosing multiple clients then I would suggest signing up for a free AWS trial and spin up a small ec2 instance and experiment on that instead of an production system

The link I posted I only wanted you to have a look at the configure-name-based-virtual-hosts section

You might also share your .conf file and we can have a look at what is going on.

but just to let you know I cant get it to run on the http://laravel.so-mad.com/laravel/public

Josh Burley replied 1 week ago

This is my thread on stack overflow asking about the same situation.

https://stackoverflow.com/questions/57413827/laravel-returns-no-input-file-specified-after-changing-virtualhosts

Interestingly one of the comments points me to another thread with a similar issue

https://stackoverflow.com/questions/14555996/no-input-file-specified

The accepted answer explains numerous potential faults within this particular CMS which could also be a flaw in the current version of Laravel. Does anyone have any more information on the inner workings of Laravel and could potentially shed some light on this

Josh Burley replied 1 week ago

I cant get it to run on the http://laravel.so-mad.com/laravel/public

This is because it currently has the changes added to the conf file. I will grab it now and show you whats going on.

Josh Burley replied 1 week ago

If its a dedicated server hosing multiple clients then I would suggest signing up for a free AWS trial and spin up a small ec2 instance and experiment on that instead of an production system

I could do this, but the idea is to have a laravel cms set up on the production system. This so-mad domain is just our testing and development domain that we use on the server for things like this.

<VirtualHost 109.169.61.133:80>
  ServerName laravel.so-mad.com
    ServerAlias www.laravel.so-mad.com
  DocumentRoot /home/somad/public_html/nobackup/laravel
  ServerAdmin [email protected]
  UseCanonicalName Off
  Options -ExecCGI -Includes
  RemoveHandler cgi-script .cgi .pl .plx .ppl .perl

  ## User somad # Needed for Cpanel::ApacheConf
  <IfModule userdir_module>
    <IfModule !mpm_itk.c>
      <IfModule !ruid2_module>
        <IfModule !mod_passenger.c>
          UserDir disabled
          UserDir enabled somad 
        </IfModule>
      </IfModule>
    </IfModule>
  </IfModule>

  # Enable backwards compatible Server Side Include expression parser for Apache versions >= 2.4.
  # To selectively use the newer Apache 2.4 expression parser, disable SSILegacyExprParser in
  # the user's .htaccess file.  For more information, please read:
  #    http://httpd.apache.org/docs/2.4/mod/mod_include.html#ssilegacyexprparser
  <IfModule include_module>
    <Directory "/home/somad/public_html/nobackup/laravel">
      SSILegacyExprParser On
    </Directory>
  </IfModule>

  

  <IfModule suphp_module>
    suPHP_UserGroup somad somad
  </IfModule>
  <IfModule suexec_module>
    <IfModule !mod_ruid2.c>
      SuexecUserGroup somad somad
    </IfModule>
  </IfModule>
  <IfModule ruid2_module>
    RMode config
    RUidGid somad somad
  </IfModule>
  <IfModule mpm_itk.c>
    # For more information on MPM ITK, please read:
    #   http://mpm-itk.sesse.net/
    AssignUserID somad somad
  </IfModule>
  <IfModule mod_passenger.c>
    PassengerUser somad
    PassengerGroup somad
  </IfModule>



    # Global DCV Rewrite Exclude
    <IfModule rewrite_module>
        RewriteOptions Inherit
    </IfModule>

        
        
            
                
                
  Include "/etc/apache2/conf.d/userdata/std/2_4/somad/laravel.so-mad.com/*.conf"
  DocumentRoot /home/somad/public_html/nobackup/laravel/laravel/public
    <IfModule proxy_fcgi_module>
        <FilesMatch \.(phtml|php[0-9]*)$>
            SetHandler proxy:unix:/opt/cpanel/ea-php73/root/usr/var/run/php-fpm/c463bd675bbb93f9c0c6359a7e202c416d3bf916.sock|fcgi://laravel.so-mad.com
        </FilesMatch>
    </IfModule>


  # To customize this VirtualHost use an include file at the following location
  # Include "/etc/apache2/conf.d/userdata/std/2_4/somad/laravel.so-mad.com/*.conf"
</VirtualHost>

As you can see its all auto generated and to be able to edit this we have to created and edit a file at;

Include "/etc/apache2/conf.d/userdata/std/2_4/somad/laravel.so-mad.com/*.conf"

That included file includes only one line that i've written and its;

DocumentRoot /home/somad/public_html/nobackup/laravel/laravel/public
Taftse replied 1 week ago

Josh are all your clients running websites on this server ?

try changing the included .conf to

DirectoryIndex index.html index.php DocumentRoot /home/somad/public_html/nobackup/laravel/laravel/public

I would still suggest booting up a vm to experiment on instead of a live system

Im currently traveling so I cant download a config from my server to show you

Josh Burley replied 1 week ago

Josh are all your clients running websites on this server ?

Quite a few of them yes, we have a couple of servers.

I updated the included conf to your suggestions but it was still the same. I have since disabled the new lines in the conf so you can see it now works fine as a standard laravel install

http://laravel.so-mad.com/laravel/public/


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us