Tomcat Apache server restart required too frequently - apache

It is troublesome to restart he server every time content gets changed. Is there any utility that detects if the content edited does not affect the working of code eg. changing variable value?

I am curious what type of change you're making. When you make a change in javascript, there is no need to restart the Tomcat server. But if you modify any thing which needs to compile then only you need to restart after recompilation. But you can configure tomcat for reload automatically your servlets, configure the attribute re-loadable to true of the Context. Take a look at context.xml.

Related

dynamic configuration of freeradius server

Currently we have to restart radiusd every time after making configuration changes. According to this man page (https://freeradius.org/radiusd/man/radmin.html) some configurations can be huped using radmin so that dynamic configuration change can be done without server restart. However, this page does not give much details on what configuration can be huped, eg. I tried to hup an eap configuration but it is not supported. Is there a check list of modules/parameters configuration that are supported by hup method?

SetEnv not updating my environment variable (noob warning)

I am still an Apache noob, and I am trying to set an environment variable that will be used by my Rails application.
I've read https://httpd.apache.org/docs/2.4/mod/mod_env.html#setenv and done some google and SO searches. I have at least determined that the value to be assigned must be in quotes. However, when I run sudo service apache2 restart, the value of SECRET_KEY_BASE is still not correct (viewed via printenv). I don't know what I don't know. Is there some step i'm missing?
In my apache configuration I have:
SetEnv SECRET_KEY_BASE "e10e721..."
# Tell Apache and Passenger where your app's 'public' directory is
DocumentRoot /var/www/some_path
Please let me know what other information I might need to share. Thanks for looking.
There are a few subtle pitfalls here.
First: You can't check it in the terminal you ran that command from. "SetEnv" sets a per-request internal variable that will be copied to CGI-like processes that the server subsequently executes.
Secondly, even if you set a real native environment variable (in e.g. /etc/apache2/envvars) you should not do a restart operation since that will not necessarily reload that particular file. You should do a stop and a start. You still won't see the variable in the command you start the server from, since it was only in the webserver process.
If you want to see the environment of a running process, you can write a basic CGI to dump the environment that was passed down to the CGI script. If you're a PHP user, a basic script with phpinfo() will dump it.
Or, you can determine Apache's process ID with ps and then check /proc/$thepid/env (on Linux).

Weblogic run configuration in IntelliJ idea - disable basic authentication

I need to disable basic auth on weblogic server, which can be done by adding <enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials> into config.xml in a weblogic domain.
I'm deploying a web service to weblogic directly from IntelliJ Idea and every time I start deploy, the config.xml is replaced by a new one, so I cannot change config manually. I guess I need to pass some extra arguments in IntelliJ's run configuration. Does anyone has any experiences with this?
It was my mistake. I tried to modify config.xml and forgot my server is still running. According to this page I think it's pretty obvious why this happens. So, it has nothing to do with IntelliJ Idea.
Caution: Do not edit configuration files for a domain that is
currently running. Because Oracle WebLogic Server rewrites the files
periodically, your changes will be lost. Depending on your platform,
you also could cause Oracle WebLogic Server failures.

Apache httpd.conf change without restart the server

According to my client requirement every time a user register to software we need to provide a separate URL. For that we are using apache and registering the new url in apache httpd.conf. Now the issue is after every new url entry we need to restart the apache server to reflect the changes. But this approach is bad because restarting the apache server also effecting the existing client. So, I would like to reflect the changes without restarting.
So, an any one help me to do that with apache.
I am also open for other tools if that can solve my issue.
Apache can't update it's configuration without restart (graceful or clean).
It's a bad idea to store generated URLs in Apache config.
Much better is to use rewrite maps or store URLs in database and rewrite them with mod_rewrite

Can I execute a shell script when restarting (starting) apache webserver

I have an application with some cacheing backend and I want to clear the cacheing whenever the webserver is been restarted.
Is there a apache configuration directive or any other way to execute a shell script upon webserver (re)start?
Thanks,
Phil
Adding some more information, as asked by some answers already:
Base system is ofc linux based, in this exact situation: CentOs
Modifying the startup script is unfortunately no option as pointed out by one of the comments already, due to it beeing not configuration file within the respective RPM packages and therefor beeing replaced by updates. Also I think modifying the startup script would be a bad thing in general
I see, that actually linking both "restarting the webserver" and "clearing my app cache" is not exactly what should be tied together. I will consider other alternatives
My situation is as follows: I can define how the virtual host config looks like, but I can not define how the rest of the servers configuration looks like.
The application is actually PHP based (and runs on the symfony framework). Symfony pre-compiles alot of stuff into dynamic php files from what it finds in the static configuration files. We deploy our apps via RPM and after deployment, an webserver restart is actually initiated already, so I thought it might make sense to tie the cache-cleanup to it. But I think after getting all your feedback, it looks like it is better to put the cache cleanup process into the installation process itself.
You haven't provided a lot of detail here, so it's hard to give a concrete answer, but I would suggest that your best option is to write a script which handles restarting apache, and clearing your cache. It would look something like this:
#!/bin/sh
# restart apache
/etc/init.d/httpd graceful
# whatever needs to be done to clear cache
rm -rf /my/cache/dir
Ramy suggests modifying the system startup script for Apache -- this is a bad idea! If and when you update Apache on your server, there is a good chance that your change will be lost.
Dirk suggests that what you are trying to do is probably misguided, and I think he's right. You haven't told us what platform you are running, but I can think of few situations where restarting your webserver and clearing a cache actually need to happen together.
You can modify Startup script for the Apache Web Server in /etc/init.d/httpd and write your own syntax inside it.
chattr +i /etc/init.d/httpd
If you have (root) access to the server you could do this by shell scripts but I would consider if it is the best way of cache management to rely on apache restarts.