I Can't reset apache. (Linux) - wordpress

I tried to install an ssl certificate, I follow an aws "link" tutorial, when I try to restart the apache server the console shows me the error: Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
use command apachectl configtest the console shows me the error: SSLCertificateKeyFile: file '/etc/pki/tls/private/localhost.key' does not exist or is empty
After following the steps in the tutorial my page no longer works because I did not finish installing the ssl certificate. How could I solve it or return the configuration prior to the change?

<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Try this as your default configuration file and restart apache. If required, modify the Document Root to your actual file serving location.

Related

asp.net core apache Internal Server Error

I am trying to deploy an ASP.net Core 3.1 app to a server with apache2 installed. I have created the following virtualhost:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ProxyPreserveHost On
ProxyPass / https://127.0.0.1:5001/
ProxyPassReverse / https://127.0.0.1:5001/
#ServerAdmin mail#mail.com
ServerName xx.app
ServerAlias www.xx.app
ErrorLog ${APACHE_LOG_DIR}xx-error.log
CustomLog ${APACHE_LOG_DIR}xx-access.log common
SSLCertificateFile /etc/letsencrypt/live/xx.app/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/xx.app/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
when i run the application (using dotnet .dll), i get the following message:
Hosting environment: Production
Content root path: /home/cv/web/publish
Now listening on: http://localhost:5000
Now listening on: https://localhost:5001
Application started. Press Ctrl+C to shut down.
Then when i try to browse the app I get the following error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
When I view the logs the only thing that I find is:
AH01144: No protocol handler was valid for the URL / (scheme 'http'). If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
I have tried to enable the mods proxy_http, http and it didn't fix the issue.
Thanks in advance!
The issue was that the virtual host needed these two lines at the start:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
and these lines at the virtualhost *443:
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off

Httpd only allows to access files that are directly created in the /var/www/html folder

I'm using Httpd for the first time and the final goal is to setup a wordpress instance on a local RHEL server (that has no external internet access).
So I installed httpd via yum and used touch hello.html inside the /var/www/html folder which worked fine and the file is available via browser. Now I started to move a html file from another computer via winScp to the root directory of the server and moved it with mv to the folder. I did also use chmod to set the correct access rights, but it didn't work.
How can I setup the server to serve these files? Atm I receive an 403 Forbidden error, so I assume I have to do something within the httpd config?
Would be very thankful for any help to get me onboard!
It's good practice to use a VirtualHost, and put the configuration in sites-enabled directory. You can of course just edit your httpd.conf and put the configuration in there. It's just not as flexible for administration.
Edit /etc/httpd/conf/httpd.conf using sudo.
Add IncludeOptional sites-enabled/*.conf at end of httpd.conf. Save and exit.
sudo mkdir /etc/httpd/sites-enabled /etc/httpd/sites-available
Using sudo, edit /etc/httpd/sites-available/mysite.conf and add the followingVirtualHosts` block:
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName mysite.domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Now create the link for the config to the sites-enabled directory
sudo ln -s /etc/httpd/sites-available/mysite.conf /etc/http/sites-enabled
To restart Apache after completing the above, do
sudo systemctl restart httpd
The alternative is to add the VirtualHost block directly in httpd.conf, then re-start Apache.

Symfony not loading up in EC2 instance AWS

I have a symfony website on digital ocean droplet, i am trying to migrate symfony website to aws ec2 instance. This is the tutorial i have followed : Deploy Symfony on Ubunut 14.04
I have followed each and every step according to the tutorial and have installed composer and other prerequisites needed. Here is the sites-available default config file for apache on my server :
<VirtualHost *:80>
ServerName miscellani.co
ServerAdmin info#miscellani.co
DocumentRoot /var/www/miscellani/web
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
But even after setting all the parameter files and everything apache is not loading up the correct index for the file but showing directories.
Output image
I have tried multiple tutorials but all showing the same output for symfony. If anyone can help me out here where i am doing it wrong or which file i need to install or redo any step it will be highly appreciated. Thank you.
Update :
Made changes as recommended by Jan but its still giving me the same parent directory rather than the website.
1st add to /etc/hosts:
127.0.0.1 localhost
127.0.0.1 miscellani.co
127.0.0.1 www.miscellani.co
Run in shell
sudo cp 000-default.conf miscellani.conf
edit miscellani.conf
Correct VirtualHost for Symfony is (miscellani.conf):
<VirtualHost *:80>
ServerName miscellani.co
ServerAlias www.miscellani.co
DocumentRoot /var/www/miscellani/web
<Directory /var/www/miscellani/web >
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
When add file run in shell command:
sudo a2enmod rewrite
sudo a2ensite miscellani
sudo service apache2 restart

Error 503 Service unavailable

just started with Symfony2 and already have a problem that i can not solve.
Installed the Symfony2 demo app on a VPS with debian. but trying to open it give me a "503 Service unavailable".
I used 'symfony demo' to install to /var/www/symfony_demo/
then added a symdemo.conf file to /etc/apache2/sites-available that look like this:
NameVirtualHost XX.XXX.XX.XXX
<VirtualHost XX.XXX.XX.XXX>
ServerName symblog.dev
DocumentRoot "/var/www/symfony_demo/web"
DirectoryIndex app.php
<Directory "/var/www/symfony_demo/web">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
XX.XXX.XX.XXX = public server IP
and activated it with a2ensite symdemo.conf
I thought that would work, but opening the IP give me the error message.
and trying to open app_dev.php give me not allowed to access this file
Could someone please give me a tip?
Nevermind. Looks like i fixed it. Following this tutorial: http://intelligentbee.com/blog/2013/08/07/symfony2-jobeet-day-1-starting-up-the-project/
just activate mod_rewrite with a2enmod rewrite and restart apache. that's it.

Can't find deployed app

I deployed my first meteor app on a digital-ocean droplet using mup. So it's there but I can't figure out what I still have to setup to actually view my app. So when I go to www.example.com I should see it but all I see is an apache page.
When you start a Meteor app, you can specify the port for it to listen on using the --port argument. For it to be available from at you domain name specify port 80. Though if you have Apache listening on that port already it will fail to bind to it. Uninstall or stop Apache, and restart your Meteor app.
If you are using Apache to serve other content and can not stop it, you'll need to have your Meteor run on a different port with an Apache ProxyPass. First enable mod_proxy and mod_proxy_http
sudo a2enmod proxy proxy_http
Then create a new VirtualHost for the Meteor app that proxies request to the port you have decided to have it listen on. It will look something like:
<VirtualHost *:80>
ServerName www.example.com
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
See this article for all the details.

Resources