Change web sharing port with AppleScript

Hello!

I want to change the personal web sharing port from xxx to 80 with AppleScript. But i dont know how i can do it
Anyone?

Thanks in advance

Any particular reason why?

Typically this kind of thing is a one-time deal. It’s an order of magnitude faster to just edit Apache’s config file than it is to think about what’s involved in doing this via AppleScript.

Just open (using sudo) /etc/httpd/httpd.conf and scroll to the line:

]Port 80

and change it to whatever you want.

Any kind of AppleScript-based solution is likely to invoke a shell script (such as sed) to do this anyway. For example, the following command line will change the port to 8000:

]sed ‘s/^Port 80/Port 8000/g’ /etc/httpd/httpd.conf