This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Control-M (^M) Characters in httpd-vhosts.conf
#1
Control-M (^M) Characters in httpd-vhosts.conf
Hi Guys,

I recently attempted to install LetsEncrypt following TGates Guide (http://forums.sentora.org/showthread.php?tid=2527) for the Panel Login. When adding the Global Sentora Entry my httpd-vhosts.conf is adding ^M Characters to the lines and Apache fails to start. If I remove these characters Apache loads fine and https is available. But httpd-vhosts.conf is getting overridden  and the ^M Characters keep returning?

I have tried typing in the lines manually. Adding just a single line (SSLEngine On) only and they ^M Characters are always there.

When I followed the TGates guide (http://forums.sentora.org/showthread.php?tid=2535) for Domains, this worked flawlessly with no issues at all.

Any help would be appreciated.

I am currently running:

Sentora 1.0.3
Ubuntu 14.04.4
Reply
Thanks given by:
#2
RE: Control-M (^M) Characters in httpd-vhosts.conf
That's interesting as both tutorials are very similar and you are the first to report this.

I remember seeing this way back in ZPanel but since that site/forum is gone, I can't check there Blush 

If you edited any files using a Windows editor (wordpad, notepad, etc.), then uploaded them to your Ubuntu server this can happen.

I suggest using notepad++ as your default editor in Windows.

Quoted from: http://stackoverflow.com/questions/15020...-each-line
Quote:Did you create this file on Windows machine and then transferred it on unix/linux machine? End of line is interpreted differently in MS-DOS and Linux/Unix environments. On MS-DOS, end of line is indicated by new line character and carriage return, whereas on Unix, new line feed indicates end of line. This causes ^M characters, if you're not careful about the transfer mode between MS-DOS and Unix/Linux


Although, this doesn't explain why one works and not the other... Sad
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#3
RE: Control-M (^M) Characters in httpd-vhosts.conf
^M Characters are encoding issues.

I would advice to use either notepad or use vi / nano using SSH and pase the modifications.

M B
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask

200$ free to start your VPS 60 days credit
Reply
Thanks given by:
#4
RE: Control-M (^M) Characters in httpd-vhosts.conf
Quote:That's interesting as both tutorials are very similar and you are the first to report this.

I remember seeing this way back in ZPanel but since that site/forum is gone, I can't check there Blush  

If you edited any files using a Windows editor (wordpad, notepad, etc.), then uploaded them to your Ubuntu server this can happen.

I used Notepad2 to create the settings needed then logged onto my panel and pasted the lines into the Global Sentora Entry under Apache Config. (In Google Chrome Browser)

Once I saved the settings I ssh'd to the server and I ran: 

Code:
php -q /etc/sentora/panel/bin/daemon.php

I then tried to

Code:
service restart apache2

 But this failed.
I looked at the httpd-vhosts.conf and saw the ^M Characters.
I then ran

Code:
dos2unix /etc/sentora/configs/apache/httpd-vhosts.conf

Restarted apache and it started. But the httpd-vhosts.conf is getting overridden and ^M Characters are returning.
If I could find out how the "php -q /etc/sentora/panel/bin/daemon.php" is getting called (Cron or something) I could change it to run dos2unix after generating the httpd-vhosts.conf file and before attempting to restart Apache2. This would get me out of trouble for the moment.

I will look at setting up a new server over the next day or so. I will then setup LetEncrypt before setting up any sites and see what happens. It's only a personal server so only two websites so will not be that hard to migrate the sites over.

Thanks for the feedback and help so far.
Reply
Thanks given by:
#5
RE: Control-M (^M) Characters in httpd-vhosts.conf
Firstly, you must login to your Sentora by zadmin account
Secondly, Goto Admin menu, Module Admin, click on Apache Config. Then remove anything related to "SSL" in textbox Global Sentora Entry and [b]Global VHost Entry[/b]

Finally, click Save Changes and restart your Sentora Daemon.

Goodluck!
Reply
Thanks given by:
#6
RE: Control-M (^M) Characters in httpd-vhosts.conf
Again, I suggest you use notepad++ as I have been using this for years now (and it is maintained/updated regularly unlike notepad2) for your editing. Running dos2unix is more of a hack than a fix. You could try and make sure there are no empty spaces after each line added to your custom vhost entries to remove the ^M.
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#7
RE: Control-M (^M) Characters in httpd-vhosts.conf
(07-09-2016, 12:35 AM)TGates Wrote: Again, I suggest you use notepad++ as I have been using this for years now (and it is maintained/updated regularly unlike notepad2) for your editing. Running dos2unix is more of a hack than a fix. You could try and make sure there are no empty spaces after each line added to your custom vhost entries to remove the ^M.

I have tried using notepad++ but this has still not fixed the issue. 

If I place a single line (by typing it in) <VirtualHost> with out pressing ENTER and saving it adds the line with no issues.

If I add (typing it) 

Code:
</VirtualHost>
<VirtualHost *:443>

I get the following in the httpd-vhosts.conf file

Code:
</VirtualHost>^M
<VirtualHost *:443>

So typing it is not working either. I am about to install Sentora on a fresh server to see what happens.
Reply
Thanks given by:
#8
RE: Control-M (^M) Characters in httpd-vhosts.conf
A fresh install of Ubuntu with Sentora, then install lets encrypt and typing all the lines in by hand still yeilds the ^M on all the lines. Sad
Reply
Thanks given by:
#9
RE: Control-M (^M) Characters in httpd-vhosts.conf
Hmmm, Me.B any suggestions? Is there something in the apache modules that does this? OS packages?
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#10
RE: Control-M (^M) Characters in httpd-vhosts.conf
This is encoding issue with windows. Create a new file in linux using Nano or VIM and paste there the file content
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask

200$ free to start your VPS 60 days credit
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
what files edit /etc/sentora/configs/apache/httpd-vhosts.conf mungujakisa 11 27 ,359 08-21-2018, 10:11 AM
Last Post: TGates
Important HTTPD not starting timce2000 4 11 ,157 03-17-2018, 06:43 AM
Last Post: TGates
httpd-vhosts.conf problem mohamadcom 5 12 ,034 02-03-2018, 08:40 AM
Last Post: TGates

Forum Jump:


Users browsing this thread: 1 Guest(s)