I have a linux server that contains many websites under vhosts, once I deleted an alt site the apache2 coud not be restarted indecating this message in the error log:
#eror log
(2)No such file or directory: apache2: could not open error log file /var/www/vhosts/deleted_Site/logs/error.log.
Unable to open logs
How can I stop that so I can start my apache2
You should modify your apache configuration, for instance in conf.d/, all configuration related to your old website, especially for error logs (look for access logs and errors logs directives specification, somewhere in your conf files, apache2.conf, httpd.conf, sites-enabled, mods or what/wherever it is).
To resolve this error, you need to stop other process using same port. In some of cases it is nginx. you can stop it
sudo /etc/init.d/nginx stop
Turn off any servers using the same port. For example to turn off nginx try this:
sudo systemctl stop nginx
Related
When I try to start the apache web server it throws an exception that says that it doesn't recognize the variables in envvars
I included an image for you to see, I believe my envvars file is fine.
sorry if this is a newbie's question but I am a newbie in apache.
this is the image, top part is the exception, bottom part is the envvars file
Could you check if "/var/run/apache2" folder is not missing?
If yes, you can try creating the folder:
mkdir /var/run/apache2
After that, please run the following command:
source /etc/apache2/envvars
Lastly, you can restart your apache:
sudo systemctl stop apache2
sudo systemctl start apache2
or
sudo systemctl restart apache2
I have installed nginx on ec2, and when I star it, I see it runs using the ec2-user.
My impression is that it is not advisable to run the webserver with ec2-user but another user.
When I look at the default configuation at /etc/nginx/nginx.conf i see user nginx; showing that a user nginx could be used.
Question now is, how do I use the nginx user to run nginx. I currently can control nginx by using sudo. If I do not, I get the following error:
systemctl stop nginx
Failed to stop nginx.service: The name org.freedesktop.PolicyKit1 was not provided by any .service files
See system logs and 'systemctl status nginx.service' for details.
How do I get to be able to control nginx like this, but with the ngin user?
when I try to switch to the user, I get the following message:
sudo -iu nginx
This account is currently not available.
But when I try to add the nginx user, I get the following message:
sudo useradd nginx
useradd: user 'nginx' already exists
SO I am not sure the correct way of dealing with this.
I installed valet-linux in kubuntu 18.04 and followed the documentation. I also changed the path to make valet command works. I also added the directory of my projects which is located in another partition using valet park and change its port to 8888 so it won't have conflict with apache which listens to port 80.
But when I run my-laravel-project.test it shows the Apache2 Ubuntu Default Page not my laravel project page which when I tested it using php artisan serve, it is working. Thanks!
I experienced the same.
Can you check if valet is running correctly?
valet status
In my case it looked like this:
Php7.2-fpm is running...
Nginx is stopped...
So I fixed it by stopping, apache since it was obviously interfering with valet:
sudo service apache2 stop
I checked the status again
valet status
and now it looked fine:
Php7.2-fpm is running...
Nginx is running...
Now Valet worked for me on Ubuntu.
add DirectoryIndex index.php to your apache config
my group and I are running a server that is based upon Django and uses mod_wsgi to run an Apache server. We will not be working on this project after it is over, so I am attempting to set up cronjob similar functionality to check if the apache server has shut down(system restart or power failure), and if it has, will restart the server for me. I've found documentation on how to check if an apache server is down and restart the server if it is, but our server uses https and thus our start command is pretty verbose.
Can I simply use the functionality provided in these examples:
https://askubuntu.com/questions/277389/cron-job-to-restart-apache
https://www.digitalocean.com/community/tutorials/how-to-use-a-simple-bash-script-to-restart-server-programs
Or do I need a much more complicated process to make this happen?
The command we use to initially start the server is
python manage.py runmodwsgi --host 0.0.0.0 --port 8001 --https-port 8000 --ssl-certificate (certificate Location) --server-name (Domain Name)
I'm pretty new to Linux and using both Mod-wsgi as well as Apache so any help is greatly appreciated.
I suppose it is not good way to resolve this problem.
I recommend you use monit (https://mmonit.com/). It is cool program for checking services.
apt-get install monit
Apache restart configuration directives:
check process httpd with pidfile /var/run/httpd.pid
group apache
start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
if failed host 127.0.0.1 port 80
protocol http then restart
if 5 restarts within 5 cycles then timeout
You are better off using the --setup-only option to mod_wsgi-express or the Django integration for it, to generate the configuration but not run it. Then as others have mentioned, integrate it into the system service manager.
The two commands for starting and stopping the Apache/mod_wsgi instance would be apachectl start and apachectl stop, where apachectl is that which was generated when running with the additional --setup-only option.
When running it as a system service, also make sure you use the --server-root option to specify a more persistent location for the generated configuration. Do not use the default under /tmp if running for anything but temporary development sessions as some Linux systems will remove files under /tmp causing things to start failing after a while.
Also, since under a service manager it would generally be starting as root, particularly if listening on port 80 is a requirement, ensure you use the --user and --group options to specify what user/group your Python web application should run as.
Read:
https://pypi.python.org/pypi/mod_wsgi
for more details of the --setup-only option and start-server commands for generating the configuration. Because you are using the Django integration, you will need to use the --setup-only option.
For more informed helped, bring your issue to the mod_wsgi mailing list. The mod_wsgi-express way of running Apache/mod_wsgi is new enough that unlikely that anyone here is really going to know much about it.
There is no need to do this at all. There is no reason to start up Apache manually; once it's installed as a system service, Ubuntu will start it up automatically on restart or crash.
You should reflect on why you feel the need to do this for Apache specifically, and not any of the other system services you depend on, such as the database.
so I installed APACHE on linux ..and I typed apachectl start and get httpd (pid 1766) already running but I can't see nothing on the browser .. When I type the local IP address of the machine, It's supposed to bring a screen with APACHE to show that it's running now ..but page keeps loading and loading ..
There're a problem with config.
First try restart (if pid already running... first stop)
Another question help you
Open httpd.conf, looking httpd.pid (or apache.pid or chain. "Pid") for the location
ps aux |grep httpd # you see process of apache running. If running stop it. Check the settings
On system ls -lisa "location_of_pid"
If any result, remove file "location_of_pid"