Skip to content
Advertisement

Error “Command “server” is not defined” using Apache on Ubuntu? [closed]

I am setting up a server (instance as you please) in google computer engine; apache, php and composer are working, htaccess has already been activated and is working

The problem is not in php or htaccess, how do I know?

phpmyadmin and the like are working correctly. The htaccess I already tested works, so much that I can access without having to put / public / in the domain

I installed a clean laravel but it does not load on the server

Advertisement

Answer

My problem was a little beyond permissions. the permissions were just part of the puzzle that I had to put together here, but in the end it worked

1º problem with paneil ajenti

I am particularly using the ajenti admin panel, because it is not possible to install cpanel on ubuntu, the fact is that ajenti was causing some clonflits in apache, the solution was to reinstall it with these commands:

sudo apt-get remove ajenti
sudo apt-get install python python-support python-lxml python-gevent openssl python-gevent-socketio python-psutil python-reconfigure python-daemon python-passlib python-requests python-dbus apt-show-versions python-catcher python-exconsole python-ldap python-pil

wget http://realrepo.ajenti.org:8888/ng/debian/pool/main/a/ajenti/ajenti_1.2.23.13_all.deb

sudo dpkg --ignore-depends=python-imaging -i ajenti_1.2.23.13_all.deb

2º problem with apache

Since I need to host multiple domains on ubuntu, with servers in different countries to slow down load times, I had several problems setting up apache. the files look like this:

  • remember to move your site to the / www folder

000-default.config

 <Directory "/www">
        AllowOverride All
 </Directory>

 ServerName 00.00.00.00 #ip

 ServerAdmin webmaster@mydomain.com

 DocumentRoot /www

default

SSLEngine on
SSLOptions  +ExportCertData +StrictRequire
SSLCertificateFile #paste here the certificate path
SSLCertificateKeyFile #paste here the path of the certificate key

<Directory /www>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride All
 Order allow,deny
 allow from all
</Directory>

enable mod_rewrite like this: sudo a2enmod rewrite

After the change, run the command on the terminal: sudo systemctl restart apache2.service

3º problem with php & composer

I had problems with php because the files were not interpreted by apache, this was the solution:

sudo apt-get purge php7.3 php7.3-cli libapache2-mod-php7.3 libapache2-mod-php php7.3-mysql phpmyadmin

sudo rm -rf /etc/php7.3

sudo apt-get install php7.2 libapache2-mod-php7.2 libapache2-mod-php php7.2-common php7.2-mysql php7.2-xml php7.2-xmlrpc php7.2-curl php7.2-gd php7.2-imagick php7.2-cli php7.2-dev php7.2-imap php7.2-mbstring php7.2-opcache php7.2-soap php7.2-zip php7.2-intl -y

sudo a2enmod php7.2
sudo systemctl restart apache2.service

In the case of the composer I had problems because I used sudo in the installation, follow solution:

 sudo chown -R $USER. ~
 sudo chown username:group /home/username/.composer
  • To find out which group you use: groups username

4º problem with permissions

the following commands resolved the issue with permission

php artisan cache:clear
sudo chmod -R 777 bootstrap/
sudo chmod -R 777 storage/
composer dump-autoload
Advertisement