LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Apache and Iptables Question (https://www.linuxquestions.org/questions/linux-newbie-8/apache-and-iptables-question-4175587998/)

belinux7 08-25-2016 06:52 PM

Apache and Iptables Question
 
2 Attachment(s)
We were just taught how to install apache server in class. I feel excited but I have 2 problems when practicing on my own.

Question 1. I copied something from the internet. Went back to my terminal to paste it inside the apache index file "index.html but I could not paste. My instructor did it with just a click on the mouse after entering edit text mode in vi "insert" why can't I paste what I copied to in the text editor. I have vi into the index file and already pressed i to insert my text.

Question 2. I was trying to configure my iptables to add the apache port number 80 but i could not copy the path with the port 22 which i will now paste and change the 22 to port 80.

Vernicronz 08-26-2016 01:52 AM

hi belinux7,

you can import and export your rules using the following way and edit the rule file with vi

[root@m26 ~]# iptables-save > something
[root@m26 ~]#
[root@m26 ~]#
[root@m26 ~]# iptables-restore < something


#all the rules will be in the file called 'something'
#you can name the file with any names..

chrism01 08-26-2016 02:24 AM

Re 1. If he did what I think, he used middle click (or double click if you don't have scroll wheel in the middle of the mouse) to paste.
Re 2. not enough info. A qn is are you using xterms (in which case mouse copy/paste and also ctrl-shift-c to copy & ctrl-shift-v to paste) should work.
If its actually a console session you'd have to use 'yank' & 'put' http://vim.wikia.com/wiki/Copy,_cut_and_paste Or just type it in - often faster .. :)

lazydog 08-26-2016 07:46 AM

Looks like you are using Redhat/Centos/Fedora here. Which version? This will tell you if you need to edit IPTABLES or FIREWALLD.

michaelk 08-26-2016 08:05 AM

I assume it is CentOS 6 and that no desktop is installed.

As a beginner I would use the system-config-firewall tool to add a rule to allow HTTP traffic. If you change 22 to 80 you will disable ssh traffic which may not be important but did you read manual configuration of that file was not recommended?

By default you must be root to create/edit files in the /var/www/... directories.

John VV 08-26-2016 11:20 PM

this is rhel or cent
so

SElinux is used !
did you also write the se rules ?
did you make a "apache" user ?

normally you would install the rpm using yum
Code:

su -
yum groupinstall "Web Server"

----------------- or this command ---------------

yum install httpd

.

it is in the base default repo

this WILL set the firewal and include the SE rules

otherwise you need to manually set these
BUT
22 and 80 ARE Open by default
or are you using "8080" ?

what is set in the httpd.conf file ?


Both rhel and Cent have LONG and very EXTENCIVE documentation on installing and setting up apache
and apache has even MORE documentation on there web site
https://httpd.apache.org/docs/2.4/

https://access.redhat.com/documentat...erprise-linux/


All times are GMT -5. The time now is 04:10 AM.