Sentora Support Forums
Control-M (^M) Characters in httpd-vhosts.conf - Printable Version

+- Sentora Support Forums (https://senforums.mach-hosting.com)
+-- Forum: Sentora Forum Archives (https://senforums.mach-hosting.com/forumdisplay.php?fid=5)
+--- Forum: Sentora Public Support Forums v1.0.x (https://senforums.mach-hosting.com/forumdisplay.php?fid=32)
+---- Forum: General Support Forum v1.0.x (https://senforums.mach-hosting.com/forumdisplay.php?fid=36)
+---- Thread: Control-M (^M) Characters in httpd-vhosts.conf (/showthread.php?tid=2927)

Pages: 1 2


Control-M (^M) Characters in httpd-vhosts.conf - mckinnon81 - 07-06-2016

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


RE: Control-M (^M) Characters in httpd-vhosts.conf - TGates - 07-07-2016

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/15020883/unix-script-appends-m-at-end-of-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


RE: Control-M (^M) Characters in httpd-vhosts.conf - Me.B - 07-07-2016

^M Characters are encoding issues.

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

M B


RE: Control-M (^M) Characters in httpd-vhosts.conf - mckinnon81 - 07-07-2016

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.


RE: Control-M (^M) Characters in httpd-vhosts.conf - tranbinhtam - 07-07-2016

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!


RE: Control-M (^M) Characters in httpd-vhosts.conf - TGates - 07-09-2016

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.


RE: Control-M (^M) Characters in httpd-vhosts.conf - mckinnon81 - 07-09-2016

(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.


RE: Control-M (^M) Characters in httpd-vhosts.conf - mckinnon81 - 07-09-2016

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


RE: Control-M (^M) Characters in httpd-vhosts.conf - TGates - 07-12-2016

Hmmm, @[Me.B] any suggestions? Is there something in the apache modules that does this? OS packages?


RE: Control-M (^M) Characters in httpd-vhosts.conf - Me.B - 07-13-2016

This is encoding issue with windows. Create a new file in linux using Nano or VIM and paste there the file content